@Immutable public final class TargetElements extends ForwardingImmutableSet<String>
Context
search. As a performance optimization,
instances of this class are cached based on the order of the elements in the set. This means
that sets "elem1,elem2" and "elem2,elem1" will be treated as two distinct objects, even though it's the same set.
We figured that if we sorted the set elements every time an instance of this class is requested, it might
result in a performance penalty, which defeats the purpose of caching in the first place. Having a few duplicate
elements here and there is better as opposed to having to sort on every invocation.
Objects of this class are made unmodifiable by having this class extend ForwardingImmutableSet
.
Created by QuijadaJ on 5/3/2017.Modifier and Type | Method and Description |
---|---|
static TargetElements |
fromSet(Set<String> pTargetElems) |
String |
toString() |
static TargetElements |
valueOf(String pTargetElems) |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public static TargetElements valueOf(String pTargetElems) throws IllegalArgumentException
IllegalArgumentException
public static TargetElements fromSet(Set<String> pTargetElems)
public String toString()
toString
in class ForwardingImmutableSet<String>
Copyright © 2019. All rights reserved.