Skip to content

Instantly share code, notes, and snippets.

@ahmedazhar05
Created January 17, 2024 19:56
Show Gist options
  • Save ahmedazhar05/3fcfc7c47141dc0d34265f7f8b4ed696 to your computer and use it in GitHub Desktop.
Save ahmedazhar05/3fcfc7c47141dc0d34265f7f8b4ed696 to your computer and use it in GitHub Desktop.
Java 8 Collections Framework with Functions
---
# source: https://docs.oracle.com/javase/8/docs/technotes/guides/collections/reference.html
Collections Framework:
Interfaces:
Set:
- boolean add(E e)
- boolean addAll(Collection<? extends E> c)
- void clear()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- boolean equals(Object o)
- int hashCode()
- boolean isEmpty()
- Iterator<E> iterator()
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- boolean retainAll(Collection<?> c)
- int size()
- default Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
List:
- boolean add(E e)
- void add(int index, E element)
- boolean addAll(Collection<? extends E> c)
- boolean addAll(int index, Collection<? extends E> c)
- void clear()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- boolean equals(Object o)
- E get(int index)
- int hashCode()
- int indexOf(Object o)
- boolean isEmpty()
- Iterator<E> iterator()
- int lastIndexOf(Object o)
- ListIterator<E> listIterator()
- ListIterator<E> listIterator(int index)
- E remove(int index)
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- default void replaceAll(UnaryOperator<E> operator)
- boolean retainAll(Collection<?> c)
- E set(int index, E element)
- int size()
- default void sort(Comparator<? super E> c)
- default Spliterator<E> spliterator()
- List<E> subList(int fromIndex, int toIndex)
- Object[] toArray()
- <T> T[] toArray(T[] a)
Queue:
- boolean add(E e)
- E element()
- boolean offer(E e)
- E peek()
- E poll()
- E remove()
Deque:
- boolean add(E e)
- void addFirst(E e)
- void addLast(E e)
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- E element()
- E getFirst()
- E getLast()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offerFirst(E e)
- boolean offerLast(E e)
- E peek()
- E peekFirst()
- E peekLast()
- E poll()
- E pollFirst()
- E pollLast()
- E pop()
- void push(E e)
- E remove()
- boolean remove(Object o)
- E removeFirst()
- boolean removeFirstOccurrence(Object o)
- E removeLast()
- boolean removeLastOccurrence(Object o)
- int size()
Map:
- void clear()
- default V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- default V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- default V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- default void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- default V getOrDefault(Object key, V defaultValue)
- int hashCode()
- boolean isEmpty()
- Set<K> keySet()
- default V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- default V putIfAbsent(K key, V value)
- V remove(Object key)
- default boolean remove(Object key, Object value)
- default V replace(K key, V value)
- default boolean replace(K key, V oldValue, V newValue)
- default void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- Collection<V> values()
SortedSet:
- Comparator<? super E> comparator()
- E first()
- SortedSet<E> headSet(E toElement)
- E last()
- default Spliterator<E> spliterator()
- SortedSet<E> subSet(E fromElement, E toElement)
- SortedSet<E> tailSet(E fromElement)
SortedMap:
- Comparator<? super K> comparator()
- Set<Map.Entry<K,V>> entrySet()
- K firstKey()
- SortedMap<K,V> headMap(K toKey)
- Set<K> keySet()
- K lastKey()
- SortedMap<K,V> subMap(K fromKey, K toKey)
- SortedMap<K,V> tailMap(K fromKey)
- Collection<V> values()
NavigableSet:
- E ceiling(E e)
- Iterator<E> descendingIterator()
- NavigableSet<E> descendingSet()
- E floor(E e)
- SortedSet<E> headSet(E toElement)
- NavigableSet<E> headSet(E toElement, boolean inclusive)
- E higher(E e)
- Iterator<E> iterator()
- E lower(E e)
- E pollFirst()
- E pollLast()
- NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- SortedSet<E> subSet(E fromElement, E toElement)
- SortedSet<E> tailSet(E fromElement)
- NavigableSet<E> tailSet(E fromElement, boolean inclusive)
NavigableMap:
- Map.Entry<K,V> ceilingEntry(K key)
- K ceilingKey(K key)
- NavigableSet<K> descendingKeySet()
- NavigableMap<K,V> descendingMap()
- Map.Entry<K,V> firstEntry()
- Map.Entry<K,V> floorEntry(K key)
- K floorKey(K key)
- SortedMap<K,V> headMap(K toKey)
- NavigableMap<K,V> headMap(K toKey, boolean inclusive)
- Map.Entry<K,V> higherEntry(K key)
- K higherKey(K key)
- Map.Entry<K,V> lastEntry()
- Map.Entry<K,V> lowerEntry(K key)
- K lowerKey(K key)
- NavigableSet<K> navigableKeySet()
- Map.Entry<K,V> pollFirstEntry()
- Map.Entry<K,V> pollLastEntry()
- NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- SortedMap<K,V> subMap(K fromKey, K toKey)
- SortedMap<K,V> tailMap(K fromKey)
- NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
BlockingQueue:
- boolean add(E e)
- boolean contains(Object o)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- E take()
TransferQueue:
- int getWaitingConsumerCount()
- boolean hasWaitingConsumer()
- void transfer(E e)
- boolean tryTransfer(E e)
- boolean tryTransfer(E e, long timeout, TimeUnit unit)
BlockingDeque:
- boolean add(E e)
- void addFirst(E e)
- void addLast(E e)
- boolean contains(Object o)
- E element()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- boolean offerFirst(E e)
- boolean offerFirst(E e, long timeout, TimeUnit unit)
- boolean offerLast(E e)
- boolean offerLast(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- E pollFirst(long timeout, TimeUnit unit)
- E pollLast(long timeout, TimeUnit unit)
- void push(E e)
- void put(E e)
- void putFirst(E e)
- void putLast(E e)
- E remove()
- boolean remove(Object o)
- boolean removeFirstOccurrence(Object o)
- boolean removeLastOccurrence(Object o)
- int size()
- E take()
- E takeFirst()
- E takeLast()
ConcurrentMap:
- default V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- default V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- default V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- default void forEach(BiConsumer<? super K,? super V> action)
- default V getOrDefault(Object key, V defaultValue)
- default V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- V putIfAbsent(K key, V value)
- boolean remove(Object key, Object value)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- default void replaceAll(BiFunction<? super K,? super V,? extends V> function)
ConcurrentNavigableMap:
- NavigableSet<K> descendingKeySet()
- ConcurrentNavigableMap<K,V> descendingMap()
- ConcurrentNavigableMap<K,V> headMap(K toKey)
- ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive)
- NavigableSet<K> keySet()
- NavigableSet<K> navigableKeySet()
- ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey)
- ConcurrentNavigableMap<K,V> tailMap(K fromKey)
- ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
General Purpose Implementation Classes:
HashSet:
- boolean add(E e)
- void clear()
- Object clone()
- boolean contains(Object o)
- boolean isEmpty()
- Iterator<E> iterator()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
TreeSet:
- boolean add(E e)
- boolean addAll(Collection<? extends E> c)
- E ceiling(E e)
- void clear()
- Object clone()
- Comparator<? super E> comparator()
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- NavigableSet<E> descendingSet()
- E first()
- E floor(E e)
- SortedSet<E> headSet(E toElement)
- NavigableSet<E> headSet(E toElement, boolean inclusive)
- E higher(E e)
- boolean isEmpty()
- Iterator<E> iterator()
- E last()
- E lower(E e)
- E pollFirst()
- E pollLast()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- SortedSet<E> subSet(E fromElement, E toElement)
- SortedSet<E> tailSet(E fromElement)
- NavigableSet<E> tailSet(E fromElement, boolean inclusive)
LinkedHashSet:
- Spliterator<E> spliterator()
ArrayList:
- boolean add(E e)
- void add(int index, E element)
- boolean addAll(Collection<? extends E> c)
- boolean addAll(int index, Collection<? extends E> c)
- void clear()
- Object clone()
- boolean contains(Object o)
- void ensureCapacity(int minCapacity)
- void forEach(Consumer<? super E> action)
- E get(int index)
- int indexOf(Object o)
- boolean isEmpty()
- Iterator<E> iterator()
- int lastIndexOf(Object o)
- ListIterator<E> listIterator()
- ListIterator<E> listIterator(int index)
- E remove(int index)
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- boolean removeIf(Predicate<? super E> filter)
- protected void removeRange(int fromIndex, int toIndex)
- void replaceAll(UnaryOperator<E> operator)
- boolean retainAll(Collection<?> c)
- E set(int index, E element)
- int size()
- void sort(Comparator<? super E> c)
- Spliterator<E> spliterator()
- List<E> subList(int fromIndex, int toIndex)
- Object[] toArray()
- <T> T[] toArray(T[] a)
- void trimToSize()
ArrayDeque:
- boolean add(E e)
- void addFirst(E e)
- void addLast(E e)
- void clear()
- ArrayDeque<E> clone()
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- E element()
- E getFirst()
- E getLast()
- boolean isEmpty()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offerFirst(E e)
- boolean offerLast(E e)
- E peek()
- E peekFirst()
- E peekLast()
- E poll()
- E pollFirst()
- E pollLast()
- E pop()
- void push(E e)
- E remove()
- boolean remove(Object o)
- E removeFirst()
- boolean removeFirstOccurrence(Object o)
- E removeLast()
- boolean removeLastOccurrence(Object o)
- int size()
- Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
LinkedList:
- boolean add(E e)
- void add(int index, E element)
- boolean addAll(Collection<? extends E> c)
- boolean addAll(int index, Collection<? extends E> c)
- void addFirst(E e)
- void addLast(E e)
- void clear()
- Object clone()
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- E element()
- E get(int index)
- E getFirst()
- E getLast()
- int indexOf(Object o)
- int lastIndexOf(Object o)
- ListIterator<E> listIterator(int index)
- boolean offer(E e)
- boolean offerFirst(E e)
- boolean offerLast(E e)
- E peek()
- E peekFirst()
- E peekLast()
- E poll()
- E pollFirst()
- E pollLast()
- E pop()
- void push(E e)
- E remove()
- E remove(int index)
- boolean remove(Object o)
- E removeFirst()
- boolean removeFirstOccurrence(Object o)
- E removeLast()
- boolean removeLastOccurrence(Object o)
- E set(int index, E element)
- int size()
- Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
PriorityQueue:
- boolean add(E e)
- void clear()
- Comparator<? super E> comparator()
- boolean contains(Object o)
- Iterator<E> iterator()
- boolean offer(E e)
- E peek()
- E poll()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
HashMap:
- void clear()
- Object clone()
- V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- V getOrDefault(Object key, V defaultValue)
- boolean isEmpty()
- Set<K> keySet()
- V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- V putIfAbsent(K key, V value)
- V remove(Object key)
- boolean remove(Object key, Object value)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- Collection<V> values()
TreeMap:
- Map.Entry<K,V> ceilingEntry(K key)
- K ceilingKey(K key)
- void clear()
- Object clone()
- Comparator<? super K> comparator()
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- NavigableSet<K> descendingKeySet()
- NavigableMap<K,V> descendingMap()
- Set<Map.Entry<K,V>> entrySet()
- Map.Entry<K,V> firstEntry()
- K firstKey()
- Map.Entry<K,V> floorEntry(K key)
- K floorKey(K key)
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- SortedMap<K,V> headMap(K toKey)
- NavigableMap<K,V> headMap(K toKey, boolean inclusive)
- Map.Entry<K,V> higherEntry(K key)
- K higherKey(K key)
- Set<K> keySet()
- Map.Entry<K,V> lastEntry()
- K lastKey()
- Map.Entry<K,V> lowerEntry(K key)
- K lowerKey(K key)
- NavigableSet<K> navigableKeySet()
- Map.Entry<K,V> pollFirstEntry()
- Map.Entry<K,V> pollLastEntry()
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> map)
- V remove(Object key)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- SortedMap<K,V> subMap(K fromKey, K toKey)
- SortedMap<K,V> tailMap(K fromKey)
- NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
- Collection<V> values()
LinkedHashMap:
- void clear()
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- V getOrDefault(Object key, V defaultValue)
- Set<K> keySet()
- protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- Collection<V> values()
Legacy implementations Classes:
Vector:
- boolean add(E e)
- void add(int index, E element)
- boolean addAll(Collection<? extends E> c)
- boolean addAll(int index, Collection<? extends E> c)
- void addElement(E obj)
- int capacity()
- void clear()
- Object clone()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- void copyInto(Object[] anArray)
- E elementAt(int index)
- Enumeration<E> elements()
- void ensureCapacity(int minCapacity)
- boolean equals(Object o)
- E firstElement()
- void forEach(Consumer<? super E> action)
- E get(int index)
- int hashCode()
- int indexOf(Object o)
- int indexOf(Object o, int index)
- void insertElementAt(E obj, int index)
- boolean isEmpty()
- Iterator<E> iterator()
- E lastElement()
- int lastIndexOf(Object o)
- int lastIndexOf(Object o, int index)
- ListIterator<E> listIterator()
- ListIterator<E> listIterator(int index)
- E remove(int index)
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- void removeAllElements()
- boolean removeElement(Object obj)
- void removeElementAt(int index)
- boolean removeIf(Predicate<? super E> filter)
- protected void removeRange(int fromIndex, int toIndex)
- void replaceAll(UnaryOperator<E> operator)
- boolean retainAll(Collection<?> c)
- E set(int index, E element)
- void setElementAt(E obj, int index)
- void setSize(int newSize)
- int size()
- void sort(Comparator<? super E> c)
- Spliterator<E> spliterator()
- List<E> subList(int fromIndex, int toIndex)
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
- void trimToSize()
Hashtable:
- void clear()
- Object clone()
- V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- boolean contains(Object value)
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Enumeration<V> elements()
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- V getOrDefault(Object key, V defaultValue)
- int hashCode()
- boolean isEmpty()
- Enumeration<K> keys()
- Set<K> keySet()
- V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> t)
- V putIfAbsent(K key, V value)
- protected void rehash()
- V remove(Object key)
- boolean remove(Object key, Object value)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- String toString()
- Collection<V> values()
Special-purpose implementations Classes:
WeakHashMap:
- void clear()
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- boolean isEmpty()
- Set<K> keySet()
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- V remove(Object key)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- Collection<V> values()
IdentityHashMap:
- void clear()
- Object clone()
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- int hashCode()
- boolean isEmpty()
- Set<K> keySet()
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- V remove(Object key)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- Collection<V> values()
CopyOnWriteArrayList:
- boolean add(E e)
- void add(int index, E element)
- boolean addAll(Collection<? extends E> c)
- boolean addAll(int index, Collection<? extends E> c)
- int addAllAbsent(Collection<? extends E> c)
- boolean addIfAbsent(E e)
- void clear()
- Object clone()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- boolean equals(Object o)
- void forEach(Consumer<? super E> action)
- E get(int index)
- int hashCode()
- int indexOf(E e, int index)
- int indexOf(Object o)
- boolean isEmpty()
- Iterator<E> iterator()
- int lastIndexOf(E e, int index)
- int lastIndexOf(Object o)
- ListIterator<E> listIterator()
- ListIterator<E> listIterator(int index)
- E remove(int index)
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- boolean removeIf(Predicate<? super E> filter)
- void replaceAll(UnaryOperator<E> operator)
- boolean retainAll(Collection<?> c)
- E set(int index, E element)
- int size()
- void sort(Comparator<? super E> c)
- Spliterator<E> spliterator()
- List<E> subList(int fromIndex, int toIndex)
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
CopyOnWriteArraySet:
- boolean add(E e)
- boolean addAll(Collection<? extends E> c)
- void clear()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- boolean equals(Object o)
- void forEach(Consumer<? super E> action)
- boolean isEmpty()
- Iterator<E> iterator()
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- boolean removeIf(Predicate<? super E> filter)
- boolean retainAll(Collection<?> c)
- int size()
- Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
EnumSet:
- static <E extends Enum<E>>EnumSet<E> allOf(Class<E> elementType)
- EnumSet<E> clone()
- static <E extends Enum<E>>EnumSet<E> complementOf(EnumSet<E> s)
- static <E extends Enum<E>>EnumSet<E> copyOf(Collection<E> c)
- static <E extends Enum<E>>EnumSet<E> copyOf(EnumSet<E> s)
- static <E extends Enum<E>>EnumSet<E> noneOf(Class<E> elementType)
- static <E extends Enum<E>>EnumSet<E> of(E e)
- static <E extends Enum<E>>EnumSet<E> of(E first, E... rest)
- static <E extends Enum<E>>EnumSet<E> of(E e1, E e2)
- static <E extends Enum<E>>EnumSet<E> of(E e1, E e2, E e3)
- static <E extends Enum<E>>EnumSet<E> of(E e1, E e2, E e3, E e4)
- static <E extends Enum<E>>EnumSet<E> of(E e1, E e2, E e3, E e4, E e5)
- static <E extends Enum<E>>EnumSet<E> range(E from, E to)
EnumMap:
- void clear()
- EnumMap<K,V> clone()
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- V get(Object key)
- int hashCode()
- Set<K> keySet()
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- V remove(Object key)
- int size()
- Collection<V> values()
Concurrent implementations Classes:
ConcurrentLinkedQueue:
- boolean add(E e)
- boolean addAll(Collection<? extends E> c)
- boolean contains(Object o)
- boolean isEmpty()
- Iterator<E> iterator()
- boolean offer(E e)
- E peek()
- E poll()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- Object[] toArray()
- <T> T[] toArray(T[] a)
LinkedBlockingQueue:
- void clear()
- boolean contains(Object o)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- E take()
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
ArrayBlockingQueue:
- boolean add(E e)
- void clear()
- boolean contains(Object o)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- E take()
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
PriorityBlockingQueue:
- boolean add(E e)
- void clear()
- Comparator<? super E> comparator()
- boolean contains(Object o)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- E take()
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
DelayQueue:
- boolean add(E e)
- void clear()
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- int size()
- E take()
- Object[] toArray()
- <T> T[] toArray(T[] a)
SynchronousQueue:
- void clear()
- boolean contains(Object o)
- boolean containsAll(Collection<?> c)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- boolean isEmpty()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- boolean retainAll(Collection<?> c)
- int size()
- Spliterator<E> spliterator()
- E take()
- Object[] toArray()
- <T> T[] toArray(T[] a)
LinkedBlockingDeque:
- boolean add(E e)
- void addFirst(E e)
- void addLast(E e)
- void clear()
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- E element()
- E getFirst()
- E getLast()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- boolean offerFirst(E e)
- boolean offerFirst(E e, long timeout, TimeUnit unit)
- boolean offerLast(E e)
- boolean offerLast(E e, long timeout, TimeUnit unit)
- E peek()
- E peekFirst()
- E peekLast()
- E poll()
- E poll(long timeout, TimeUnit unit)
- E pollFirst()
- E pollFirst(long timeout, TimeUnit unit)
- E pollLast()
- E pollLast(long timeout, TimeUnit unit)
- E pop()
- void push(E e)
- void put(E e)
- void putFirst(E e)
- void putLast(E e)
- int remainingCapacity()
- E remove()
- boolean remove(Object o)
- E removeFirst()
- boolean removeFirstOccurrence(Object o)
- E removeLast()
- boolean removeLastOccurrence(Object o)
- int size()
- Spliterator<E> spliterator()
- E take()
- E takeFirst()
- E takeLast()
- Object[] toArray()
- <T> T[] toArray(T[] a)
- String toString()
LinkedTransferQueue:
- boolean add(E e)
- boolean contains(Object o)
- int drainTo(Collection<? super E> c)
- int drainTo(Collection<? super E> c, int maxElements)
- int getWaitingConsumerCount()
- boolean hasWaitingConsumer()
- boolean isEmpty()
- Iterator<E> iterator()
- boolean offer(E e)
- boolean offer(E e, long timeout, TimeUnit unit)
- E peek()
- E poll()
- E poll(long timeout, TimeUnit unit)
- void put(E e)
- int remainingCapacity()
- boolean remove(Object o)
- int size()
- Spliterator<E> spliterator()
- E take()
- void transfer(E e)
- boolean tryTransfer(E e)
- boolean tryTransfer(E e, long timeout, TimeUnit unit)
ConcurrentHashMap:
- void clear()
- V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- boolean contains(Object value)
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- Enumeration<V> elements()
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- void forEach(BiConsumer<? super K,? super V> action)
- void forEach(long parallelismThreshold, BiConsumer<? super K,? super V> action)
- <U> void forEach(long parallelismThreshold, BiFunction<? super K,? super V,? extends U> transformer, Consumer<? super U> action)
- void forEachEntry(long parallelismThreshold, Consumer<? super Map.Entry<K,V>> action)
- <U> void forEachEntry(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> transformer, Consumer<? super U> action)
- void forEachKey(long parallelismThreshold, Consumer<? super K> action)
- <U> void forEachKey(long parallelismThreshold, Function<? super K,? extends U> transformer, Consumer<? super U> action)
- void forEachValue(long parallelismThreshold, Consumer<? super V> action)
- <U> void forEachValue(long parallelismThreshold, Function<? super V,? extends U> transformer, Consumer<? super U> action)
- V get(Object key)
- V getOrDefault(Object key, V defaultValue)
- int hashCode()
- boolean isEmpty()
- Enumeration<K> keys()
- ConcurrentHashMap.KeySetView<K,V> keySet()
- ConcurrentHashMap.KeySetView<K,V> keySet(V mappedValue)
- long mappingCount()
- V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- static <K> ConcurrentHashMap.KeySetView<K,Boolean> newKeySet()
- static <K> ConcurrentHashMap.KeySetView<K,Boolean> newKeySet(int initialCapacity)
- V put(K key, V value)
- void putAll(Map<? extends K,? extends V> m)
- V putIfAbsent(K key, V value)
- <U> U reduce(long parallelismThreshold, BiFunction<? super K,? super V,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)
- Map.Entry<K,V> reduceEntries(long parallelismThreshold, BiFunction<Map.Entry<K,V>,Map.Entry<K,V>,? extends Map.Entry<K,V>> reducer)
- <U> U reduceEntries(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)
- double reduceEntriesToDouble(long parallelismThreshold, ToDoubleFunction<Map.Entry<K,V>> transformer, double basis, DoubleBinaryOperator reducer)
- int reduceEntriesToInt(long parallelismThreshold, ToIntFunction<Map.Entry<K,V>> transformer, int basis, IntBinaryOperator reducer)
- long reduceEntriesToLong(long parallelismThreshold, ToLongFunction<Map.Entry<K,V>> transformer, long basis, LongBinaryOperator reducer)
- K reduceKeys(long parallelismThreshold, BiFunction<? super K,? super K,? extends K> reducer)
- <U> U reduceKeys(long parallelismThreshold, Function<? super K,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)
- double reduceKeysToDouble(long parallelismThreshold, ToDoubleFunction<? super K> transformer, double basis, DoubleBinaryOperator reducer)
- int reduceKeysToInt(long parallelismThreshold, ToIntFunction<? super K> transformer, int basis, IntBinaryOperator reducer)
- long reduceKeysToLong(long parallelismThreshold, ToLongFunction<? super K> transformer, long basis, LongBinaryOperator reducer)
- double reduceToDouble(long parallelismThreshold, ToDoubleBiFunction<? super K,? super V> transformer, double basis, DoubleBinaryOperator reducer)
- int reduceToInt(long parallelismThreshold, ToIntBiFunction<? super K,? super V> transformer, int basis, IntBinaryOperator reducer)
- long reduceToLong(long parallelismThreshold, ToLongBiFunction<? super K,? super V> transformer, long basis, LongBinaryOperator reducer)
- V reduceValues(long parallelismThreshold, BiFunction<? super V,? super V,? extends V> reducer)
- <U> U reduceValues(long parallelismThreshold, Function<? super V,? extends U> transformer, BiFunction<? super U,? super U,? extends U> reducer)
- double reduceValuesToDouble(long parallelismThreshold, ToDoubleFunction<? super V> transformer, double basis, DoubleBinaryOperator reducer)
- int reduceValuesToInt(long parallelismThreshold, ToIntFunction<? super V> transformer, int basis, IntBinaryOperator reducer)
- long reduceValuesToLong(long parallelismThreshold, ToLongFunction<? super V> transformer, long basis, LongBinaryOperator reducer)
- V remove(Object key)
- boolean remove(Object key, Object value)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- <U> U search(long parallelismThreshold, BiFunction<? super K,? super V,? extends U> searchFunction)
- <U> U searchEntries(long parallelismThreshold, Function<Map.Entry<K,V>,? extends U> searchFunction)
- <U> U searchKeys(long parallelismThreshold, Function<? super K,? extends U> searchFunction)
- <U> U searchValues(long parallelismThreshold, Function<? super V,? extends U> searchFunction)
- int size()
- String toString()
- Collection<V> values()
ConcurrentSkipListSet:
- boolean add(E e)
- E ceiling(E e)
- void clear()
- ConcurrentSkipListSet<E> clone()
- Comparator<? super E> comparator()
- boolean contains(Object o)
- Iterator<E> descendingIterator()
- NavigableSet<E> descendingSet()
- boolean equals(Object o)
- E first()
- E floor(E e)
- NavigableSet<E> headSet(E toElement)
- NavigableSet<E> headSet(E toElement, boolean inclusive)
- E higher(E e)
- boolean isEmpty()
- Iterator<E> iterator()
- E last()
- E lower(E e)
- E pollFirst()
- E pollLast()
- boolean remove(Object o)
- boolean removeAll(Collection<?> c)
- int size()
- Spliterator<E> spliterator()
- NavigableSet<E> subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)
- NavigableSet<E> subSet(E fromElement, E toElement)
- NavigableSet<E> tailSet(E fromElement)
- NavigableSet<E> tailSet(E fromElement, boolean inclusive)
ConcurrentSkipListMap:
- Map.Entry<K,V> ceilingEntry(K key)
- K ceilingKey(K key)
- void clear()
- ConcurrentSkipListMap<K,V> clone()
- Comparator<? super K> comparator()
- V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
- V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
- boolean containsKey(Object key)
- boolean containsValue(Object value)
- NavigableSet<K> descendingKeySet()
- ConcurrentNavigableMap<K,V> descendingMap()
- Set<Map.Entry<K,V>> entrySet()
- boolean equals(Object o)
- Map.Entry<K,V> firstEntry()
- K firstKey()
- Map.Entry<K,V> floorEntry(K key)
- K floorKey(K key)
- void forEach(BiConsumer<? super K,? super V> action)
- V get(Object key)
- V getOrDefault(Object key, V defaultValue)
- ConcurrentNavigableMap<K,V> headMap(K toKey)
- ConcurrentNavigableMap<K,V> headMap(K toKey, boolean inclusive)
- Map.Entry<K,V> higherEntry(K key)
- K higherKey(K key)
- boolean isEmpty()
- NavigableSet<K> keySet()
- Map.Entry<K,V> lastEntry()
- K lastKey()
- Map.Entry<K,V> lowerEntry(K key)
- K lowerKey(K key)
- V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
- NavigableSet<K> navigableKeySet()
- Map.Entry<K,V> pollFirstEntry()
- Map.Entry<K,V> pollLastEntry()
- V put(K key, V value)
- V putIfAbsent(K key, V value)
- V remove(Object key)
- boolean remove(Object key, Object value)
- V replace(K key, V value)
- boolean replace(K key, V oldValue, V newValue)
- void replaceAll(BiFunction<? super K,? super V,? extends V> function)
- int size()
- ConcurrentNavigableMap<K,V> subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
- ConcurrentNavigableMap<K,V> subMap(K fromKey, K toKey)
- ConcurrentNavigableMap<K,V> tailMap(K fromKey)
- ConcurrentNavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
- Collection<V> values()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment