import gnu.trove.list.array.TIntArrayList;
public class Example1 {
public static void main(String[] args) {
TIntArrayList numbers = new TIntArrayList();
for (int i = 0; i < 100000000; i++) {
numbers.add(i);
}
numbers.sort();
int index = numbers.binarySearch(999999);
System.out.println("Index: " + index);
}
}
import gnu.trove.map.hash.TObjectIntHashMap;
public class Example2 {
public static void main(String[] args) {
String[] words = article.split(" ");
TObjectIntHashMap<String> wordCounts = new TObjectIntHashMap<>();
for (String word : words) {
wordCounts.adjustOrPutValue(word, 1, 1);
}
for (String word : wordCounts.keySet()) {
int count = wordCounts.get(word);
System.out.println(word + ": " + count);
}
}
}