Package org.onlab.util
Class ExtendedSet<E>
- java.lang.Object
- 
- org.onlab.util.ExtendedSet<E>
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<E>,- java.util.Collection<E>,- java.util.Set<E>
 
 public class ExtendedSet<E> extends java.lang.Object implements java.util.Set<E>A Set providing additional get, insertOrReplace and conditionalRemove methods.
- 
- 
Constructor SummaryConstructors Constructor Description ExtendedSet(java.util.Map<E,E> map)Constructs a new instance by backing it with the supplied Map.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)booleanaddAll(java.util.Collection<? extends E> c)voidclear()booleanconditionalRemove(E entry, java.util.function.Predicate<E> entryTest)Removes the entry if the supplied predicate evaluates to true.booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)Eget(java.lang.Object o)Returns set element that is equal to the specified object.booleaninsertOrReplace(E entry, java.util.function.Predicate<E> entryTest)Inserts the entry if it is not already in the set otherwise replaces the existing entry if the supplied predicate evaluates to true.booleanisEmpty()java.util.Iterator<E>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()java.lang.Object[]toArray()<T> T[]toArray(T[] a)
 
- 
- 
- 
Method Detail- 
getpublic E get(java.lang.Object o) Returns set element that is equal to the specified object.- Parameters:
- o- object
- Returns:
- set element that is equal to the input argument or null if no such set element exists
 
 - 
insertOrReplacepublic boolean insertOrReplace(E entry, java.util.function.Predicate<E> entryTest) Inserts the entry if it is not already in the set otherwise replaces the existing entry if the supplied predicate evaluates to true.- Parameters:
- entry- entry to add
- entryTest- predicate that is used to evaluate if the existing entry should be replaced
- Returns:
- true if the set is updated; false otherwise
 
 - 
conditionalRemovepublic boolean conditionalRemove(E entry, java.util.function.Predicate<E> entryTest) Removes the entry if the supplied predicate evaluates to true.- Parameters:
- entry- entry to remove
- entryTest- predicate that is used to evaluated aginst the existing entry. Return value of true implies value should be removed.
- Returns:
- true if the set is updated; false otherwise
 
 - 
sizepublic int size() 
 - 
isEmptypublic boolean isEmpty() 
 - 
containspublic boolean contains(java.lang.Object o) 
 - 
iteratorpublic java.util.Iterator<E> iterator() 
 - 
toArraypublic java.lang.Object[] toArray() 
 - 
toArraypublic <T> T[] toArray(T[] a) 
 - 
addpublic boolean add(E e) 
 - 
removepublic boolean remove(java.lang.Object o) 
 - 
containsAllpublic boolean containsAll(java.util.Collection<?> c) 
 - 
addAllpublic boolean addAll(java.util.Collection<? extends E> c) 
 - 
retainAllpublic boolean retainAll(java.util.Collection<?> c) 
 - 
removeAllpublic boolean removeAll(java.util.Collection<?> c) 
 
- 
 
-