2016-12-02 17:05:15 -08:00
|
|
|
// collections/CollectionDifferences.java
|
2020-10-07 13:35:40 -06:00
|
|
|
// (c)2020 MindView LLC: see Copyright.txt
|
2015-11-15 15:51:35 -08:00
|
|
|
// We make no guarantees that this code is fit for any purpose.
|
2016-09-23 13:23:35 -06:00
|
|
|
// Visit http://OnJava8.com for more book information.
|
2015-11-11 20:20:04 -08:00
|
|
|
import onjava.*;
|
2015-06-15 17:47:35 -07:00
|
|
|
|
2016-12-02 17:05:15 -08:00
|
|
|
public class CollectionDifferences {
|
2015-06-15 17:47:35 -07:00
|
|
|
public static void main(String[] args) {
|
2015-12-15 11:47:04 -08:00
|
|
|
CollectionMethodDifferences.main(args);
|
2015-06-15 17:47:35 -07:00
|
|
|
}
|
2015-09-07 11:44:36 -06:00
|
|
|
}
|
|
|
|
/* Output:
|
2015-06-15 17:47:35 -07:00
|
|
|
Collection: [add, addAll, clear, contains, containsAll,
|
2015-11-11 20:20:04 -08:00
|
|
|
equals, forEach, hashCode, isEmpty, iterator,
|
2015-06-15 17:47:35 -07:00
|
|
|
parallelStream, remove, removeAll, removeIf, retainAll,
|
|
|
|
size, spliterator, stream, toArray]
|
|
|
|
Interfaces in Collection: [Iterable]
|
|
|
|
Set extends Collection, adds: []
|
|
|
|
Interfaces in Set: [Collection]
|
|
|
|
HashSet extends Set, adds: []
|
|
|
|
Interfaces in HashSet: [Set, Cloneable, Serializable]
|
|
|
|
LinkedHashSet extends HashSet, adds: []
|
2017-05-10 11:45:39 -06:00
|
|
|
Interfaces in LinkedHashSet: [Set, Cloneable,
|
|
|
|
Serializable]
|
|
|
|
TreeSet extends Set, adds: [headSet,
|
|
|
|
descendingIterator, descendingSet, pollLast, subSet,
|
|
|
|
floor, tailSet, ceiling, last, lower, comparator,
|
|
|
|
pollFirst, first, higher]
|
2015-06-15 17:47:35 -07:00
|
|
|
Interfaces in TreeSet: [NavigableSet, Cloneable,
|
|
|
|
Serializable]
|
2017-05-10 11:45:39 -06:00
|
|
|
List extends Collection, adds: [replaceAll, get,
|
|
|
|
indexOf, subList, set, sort, lastIndexOf, listIterator]
|
2015-06-15 17:47:35 -07:00
|
|
|
Interfaces in List: [Collection]
|
2017-05-10 11:45:39 -06:00
|
|
|
ArrayList extends List, adds: [trimToSize,
|
|
|
|
ensureCapacity]
|
|
|
|
Interfaces in ArrayList: [List, RandomAccess,
|
|
|
|
Cloneable, Serializable]
|
|
|
|
LinkedList extends List, adds: [offerFirst, poll,
|
|
|
|
getLast, offer, getFirst, removeFirst, element,
|
|
|
|
removeLastOccurrence, peekFirst, peekLast, push,
|
|
|
|
pollFirst, removeFirstOccurrence, descendingIterator,
|
|
|
|
pollLast, removeLast, pop, addLast, peek, offerLast,
|
|
|
|
addFirst]
|
2015-06-15 17:47:35 -07:00
|
|
|
Interfaces in LinkedList: [List, Deque, Cloneable,
|
|
|
|
Serializable]
|
|
|
|
Queue extends Collection, adds: [poll, peek, offer,
|
|
|
|
element]
|
|
|
|
Interfaces in Queue: [Collection]
|
|
|
|
PriorityQueue extends Queue, adds: [comparator]
|
|
|
|
Interfaces in PriorityQueue: [Serializable]
|
2017-05-10 11:45:39 -06:00
|
|
|
Map: [clear, compute, computeIfAbsent,
|
|
|
|
computeIfPresent, containsKey, containsValue, entrySet,
|
|
|
|
equals, forEach, get, getOrDefault, hashCode, isEmpty,
|
|
|
|
keySet, merge, put, putAll, putIfAbsent, remove,
|
|
|
|
replace, replaceAll, size, values]
|
2015-06-15 17:47:35 -07:00
|
|
|
HashMap extends Map, adds: []
|
|
|
|
Interfaces in HashMap: [Map, Cloneable, Serializable]
|
|
|
|
LinkedHashMap extends HashMap, adds: []
|
|
|
|
Interfaces in LinkedHashMap: [Map]
|
2017-05-10 11:45:39 -06:00
|
|
|
SortedMap extends Map, adds: [lastKey, subMap,
|
|
|
|
comparator, firstKey, headMap, tailMap]
|
2015-06-15 17:47:35 -07:00
|
|
|
Interfaces in SortedMap: [Map]
|
|
|
|
TreeMap extends Map, adds: [descendingKeySet,
|
2017-05-10 11:45:39 -06:00
|
|
|
navigableKeySet, higherEntry, higherKey, floorKey,
|
|
|
|
subMap, ceilingKey, pollLastEntry, firstKey, lowerKey,
|
|
|
|
headMap, tailMap, lowerEntry, ceilingEntry,
|
|
|
|
descendingMap, pollFirstEntry, lastKey, firstEntry,
|
|
|
|
floorEntry, comparator, lastEntry]
|
2015-06-15 17:47:35 -07:00
|
|
|
Interfaces in TreeMap: [NavigableMap, Cloneable,
|
|
|
|
Serializable]
|
2015-09-07 11:44:36 -06:00
|
|
|
*/
|