Package com.landawn.abacus.util
Class ImmutableCollection<E>
java.lang.Object
java.util.AbstractCollection<E>
com.landawn.abacus.util.ImmutableCollection<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
Immutable
,Iterable<E>
,Collection<E>
- Direct Known Subclasses:
ImmutableList
,ImmutableSet
- Since:
- 0.8
- Author:
- Haiyang Li
-
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Deprecated.final boolean
addAll
(Collection<? extends E> newElements) Deprecated.throwsUnsupportedOperationException
final void
clear()
Deprecated.throwsUnsupportedOperationException
boolean
boolean
int
hashCode()
iterator()
final boolean
Deprecated.throwsUnsupportedOperationException
final boolean
removeAll
(Collection<?> oldElements) Deprecated.throwsUnsupportedOperationException
boolean
Deprecated.throwsUnsupportedOperationException
final boolean
retainAll
(Collection<?> elementsToKeep) Deprecated.throwsUnsupportedOperationException
int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
static <E> ImmutableCollection<E>
wrap
(Collection<? extends E> c) Deprecated.the ImmutableCollection may be modified through the specifiedCollection
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty
Methods inherited from interface java.util.Collection
parallelStream, spliterator, stream, toArray
-
Method Details
-
wrap
Deprecated.the ImmutableCollection may be modified through the specifiedCollection
- Type Parameters:
E
-- Parameters:
c
-- Returns:
- an
ImmutableCollection
backed by the specifiedCollection
-
add
Deprecated.throwsUnsupportedOperationException
- Specified by:
add
in interfaceCollection<E>
- Overrides:
add
in classAbstractCollection<E>
- Parameters:
e
-- Returns:
- Throws:
UnsupportedOperationException
-
addAll
@Deprecated public final boolean addAll(Collection<? extends E> newElements) throws UnsupportedOperationException Deprecated.throwsUnsupportedOperationException
Adds the all.- Specified by:
addAll
in interfaceCollection<E>
- Overrides:
addAll
in classAbstractCollection<E>
- Parameters:
newElements
-- Returns:
- Throws:
UnsupportedOperationException
-
remove
Deprecated.throwsUnsupportedOperationException
- Specified by:
remove
in interfaceCollection<E>
- Overrides:
remove
in classAbstractCollection<E>
- Parameters:
object
-- Returns:
- Throws:
UnsupportedOperationException
-
removeIf
@Deprecated public boolean removeIf(Predicate<? super E> filter) throws UnsupportedOperationException Deprecated.throwsUnsupportedOperationException
Removes the if.- Specified by:
removeIf
in interfaceCollection<E>
- Parameters:
filter
-- Returns:
- Throws:
UnsupportedOperationException
-
removeAll
@Deprecated public final boolean removeAll(Collection<?> oldElements) throws UnsupportedOperationException Deprecated.throwsUnsupportedOperationException
Removes the all.- Specified by:
removeAll
in interfaceCollection<E>
- Overrides:
removeAll
in classAbstractCollection<E>
- Parameters:
oldElements
-- Returns:
- Throws:
UnsupportedOperationException
-
retainAll
@Deprecated public final boolean retainAll(Collection<?> elementsToKeep) throws UnsupportedOperationException Deprecated.throwsUnsupportedOperationException
- Specified by:
retainAll
in interfaceCollection<E>
- Overrides:
retainAll
in classAbstractCollection<E>
- Parameters:
elementsToKeep
-- Returns:
- Throws:
UnsupportedOperationException
-
clear
Deprecated.throwsUnsupportedOperationException
- Specified by:
clear
in interfaceCollection<E>
- Overrides:
clear
in classAbstractCollection<E>
- Throws:
UnsupportedOperationException
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Overrides:
contains
in classAbstractCollection<E>
- Parameters:
o
-- Returns:
-
iterator
- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in classAbstractCollection<E>
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in classAbstractCollection<E>
-
toArray
- Specified by:
toArray
in interfaceCollection<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArray
in interfaceCollection<E>
- Overrides:
toArray
in classAbstractCollection<E>
- Type Parameters:
T
-- Parameters:
a
-- Returns:
-
equals
- Specified by:
equals
in interfaceCollection<E>
- Overrides:
equals
in classObject
- Parameters:
obj
-- Returns:
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<E>
- Overrides:
hashCode
in classObject
-
toString
- Overrides:
toString
in classAbstractCollection<E>
-
UnsupportedOperationException