Package org.apache.rat.utils
Class ReportingSet<T>
java.lang.Object
org.apache.rat.utils.ReportingSet<T>
- Type Parameters:
T
- the type of object
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Set<T>
,SortedSet<T>
A sorted set that reports insertion collisions.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll(Collection<? extends T> c)
boolean
addAllIfNotPresent(Collection<? extends T> c)
boolean
addIfNotPresent(T e)
Adds the item if it is not present.void
clear()
Comparator<? super T>
boolean
boolean
containsAll(Collection<?> c)
boolean
first()
void
int
hashCode()
boolean
isEmpty()
iterator()
last()
boolean
boolean
removeAll(Collection<?> c)
boolean
boolean
retainAll(Collection<?> c)
If set true attempts to duplicate will throw an IllegalArgumentException.Sets the log that the reporting set will log to.setLogLevel(Log.Level level)
Sets the log level that the reporting set will log at.setMsgFormat(Function<T,String> msgFmt)
Sets the function to generate the log message.int
size()
stream()
Object[]
toArray()
<T> T[]
toArray(T[] a)
-
Constructor Details
-
ReportingSet
public ReportingSet()Constructor. Creates a TreeSet of type T. -
ReportingSet
Constructs.- Parameters:
delegate
- the SortedSet to delegate to.
-
-
Method Details
-
setMsgFormat
Sets the function to generate the log message.- Parameters:
msgFmt
- A function to return the string to be displayed when a collision occurs.- Returns:
- This for chaining.
-
setDuplicateOption
If set true attempts to duplicate will throw an IllegalArgumentException. The default state is false;.- Parameters:
state
- the state to set.- Returns:
- this for chaining.
-
setLog
Sets the log that the reporting set will log to. if not set the DefaultLog is used.- Parameters:
log
- the Log implementation to use.- Returns:
- this for chaining.
-
setLogLevel
Sets the log level that the reporting set will log at. if not set the default level is WARN.- Parameters:
level
- the log level to use.- Returns:
- this for chaining.
-
addIfNotPresent
Adds the item if it is not present. Does not report collisions.- Parameters:
e
- the item to add.- Returns:
- true if the item was added, false otherwise.
-
add
-
addAll
-
addAllIfNotPresent
-
clear
public void clear() -
comparator
- Specified by:
comparator
in interfaceSortedSet<T>
-
contains
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceSet<T>
-
equals
-
first
-
forEach
-
hashCode
public int hashCode() -
headSet
-
isEmpty
public boolean isEmpty() -
iterator
-
last
-
parallelStream
- Specified by:
parallelStream
in interfaceCollection<T>
-
remove
-
removeAll
-
removeIf
- Specified by:
removeIf
in interfaceCollection<T>
-
retainAll
-
size
public int size() -
spliterator
- Specified by:
spliterator
in interfaceCollection<T>
- Specified by:
spliterator
in interfaceIterable<T>
- Specified by:
spliterator
in interfaceSet<T>
- Specified by:
spliterator
in interfaceSortedSet<T>
-
stream
- Specified by:
stream
in interfaceCollection<T>
-
subSet
-
tailSet
-
toArray
-
toArray
public <T> T[] toArray(T[] a)
-