Class ImmutableCharByteSingletonMap
- java.lang.Object
-
- org.eclipse.collections.impl.map.immutable.primitive.ImmutableCharByteSingletonMap
-
- All Implemented Interfaces:
java.io.Serializable,ByteIterable,ByteValuesMap,CharByteMap,ImmutableCharByteMap,PrimitiveIterable
final class ImmutableCharByteSingletonMap extends java.lang.Object implements ImmutableCharByteMap, java.io.Serializable
ImmutableCharByteSingletonMap is an optimization forImmutableCharByteMapof size 1. This file was automatically generated from template file immutablePrimitivePrimitiveSingletonMap.stg.- Since:
- 4.0.
-
-
Field Summary
Fields Modifier and Type Field Description private static byteEMPTY_VALUEprivate charkey1private static longserialVersionUIDprivate bytevalue1
-
Constructor Summary
Constructors Constructor Description ImmutableCharByteSingletonMap(char key1, byte value1)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallSatisfy(BytePredicate predicate)Returns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.booleanallSatisfyKeyValue(CharBytePredicate predicate)booleananySatisfy(BytePredicate predicate)Returns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.voidappendString(java.lang.Appendable appendable)Prints a string representation of this collection onto the givenAppendable.voidappendString(java.lang.Appendable appendable, java.lang.String separator)Prints a string representation of this collection onto the givenAppendable.voidappendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)Prints a string representation of this collection onto the givenAppendable.LazyByteIterableasLazy()Returns a LazyByteIterable adapter wrapping the source ByteIterable.doubleaverage()ByteIteratorbyteIterator()Returns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.RichIterable<ByteIterable>chunk(int size)Partitions elements in fixed size chunks.<V> ImmutableBag<V>collect(ByteToObjectFunction<? extends V> function)Returns a new collection with the results of applying the specified function on each element of the source collection.booleancontains(byte value)Returns true if the value is contained in the ByteIterable, and false if it is not.booleancontainsAll(byte... source)Returns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.booleancontainsAll(ByteIterable source)Returns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.booleancontainsKey(char key)Returns whether or not the key is present in the map.booleancontainsValue(byte value)Returns whether or not this map contains the value.intcount(BytePredicate predicate)Returns a count of the number of elements in the ByteIterable that return true for the specified predicate.bytedetectIfNone(BytePredicate predicate, byte ifNone)voideach(ByteProcedure procedure)A synonym for forEach.booleanequals(java.lang.Object obj)Follows the same general contract asMap.equals(Object).ImmutableByteCharMapflipUniqueValues()Return the ByteCharMap that is obtained by flipping the direction of this map and making the associations from value to key.voidforEachKey(CharProcedure procedure)Iterates through each key in the map, invoking the procedure for each.voidforEachKeyValue(CharByteProcedure procedure)Iterates through each key/value pair in the map, invoking the procedure for each.voidforEachValue(ByteProcedure procedure)Iterates through each value in this map.byteget(char key)Retrieves the value associated with the key.bytegetIfAbsent(char key, byte ifAbsent)Retrieves the value associated with the key, returning the specified default value if no such mapping exists.bytegetOrThrow(char key)Retrieves the value associated with the key, throwing anIllegalStateExceptionif no such mapping exists.inthashCode()Follows the same general contract asMap.hashCode().<T> TinjectInto(T injectedValue, ObjectByteToObjectFunction<? super T,? extends T> function)booleanisEmpty()Returns true if this iterable has zero items.MutableCharSetkeySet()Returns a set containing all the keys in this map.LazyCharIterablekeysView()Returns a view of the keys in this map.RichIterable<CharBytePair>keyValuesView()Returns a view of the key/value pairs in this map.java.lang.StringmakeString()Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).java.lang.StringmakeString(java.lang.String separator)Returns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).java.lang.StringmakeString(java.lang.String start, java.lang.String separator, java.lang.String end)Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.bytemax()bytemaxIfEmpty(byte defaultValue)doublemedian()bytemin()byteminIfEmpty(byte defaultValue)ImmutableCharByteMapnewWithKeyValue(char key, byte value)Copy this map, associate the value with the key (replacing the value if one already exists forkey), and return the copy as new immutable map.ImmutableCharByteMapnewWithoutAllKeys(CharIterable keys)Copy this map, remove any associated values with the specified keys (if any exist), and return the copy as a new immutable map.ImmutableCharByteMapnewWithoutKey(char key)Copy this map, remove any associated value with the key (if one exists), and return the copy as a new immutable map.booleannoneSatisfy(BytePredicate predicate)Returns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.booleannotEmpty()The English equivalent of !this.isEmpty()ImmutableByteBagreject(BytePredicate predicate)Returns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.ImmutableCharByteMapreject(CharBytePredicate predicate)Return a copy of this map containing only the key/value pairs that do not match the predicate.ImmutableByteBagselect(BytePredicate predicate)Returns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.ImmutableCharByteMapselect(CharBytePredicate predicate)Return a copy of this map containing only the key/value pairs that match the predicate.intsize()Returns the number of items in this iterable.longsum()byte[]toArray()Converts the ByteIterable to a primitive byte array.byte[]toArray(byte[] target)Converts the ByteIterable to a primitive byte array.MutableByteBagtoBag()Converts the ByteIterable to a new MutableByteBag.ImmutableCharByteMaptoImmutable()Returns a copy of this map that is immutable (if this map is mutable) or itself if it is already immutable.MutableByteListtoList()Converts the ByteIterable to a new MutableByteList.MutableByteSettoSet()Converts the ByteIterable to a new MutableByteSet.byte[]toSortedArray()MutableByteListtoSortedList()java.lang.StringtoString()Follows the same general contract asAbstractMap.toString()MutableByteCollectionvalues()Returns the values in this map as a separate collection.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.ByteIterable
averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAny, containsAny, containsNone, containsNone, flatCollect, forEach, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, medianIfEmpty, reduce, reduceIfEmpty, reject, select, summaryStatistics, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.map.primitive.ByteValuesMap
tap
-
Methods inherited from interface org.eclipse.collections.api.map.primitive.CharByteMap
injectIntoKeyValue
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
EMPTY_VALUE
private static final byte EMPTY_VALUE
- See Also:
- Constant Field Values
-
key1
private final char key1
-
value1
private final byte value1
-
-
Method Detail
-
get
public byte get(char key)
Description copied from interface:CharByteMapRetrieves the value associated with the key. If no mapping exists for the key, the default value (usually0) is returned.- Specified by:
getin interfaceCharByteMap- Parameters:
key- the key- Returns:
- the value associated with the key, or the default value if no such mapping exists
-
getIfAbsent
public byte getIfAbsent(char key, byte ifAbsent)Description copied from interface:CharByteMapRetrieves the value associated with the key, returning the specified default value if no such mapping exists.- Specified by:
getIfAbsentin interfaceCharByteMap- Parameters:
key- the keyifAbsent- the default value to return if no mapping exists forkey- Returns:
- the value associated with the key, or
ifAbsentif no such mapping exists.
-
getOrThrow
public byte getOrThrow(char key)
Description copied from interface:CharByteMapRetrieves the value associated with the key, throwing anIllegalStateExceptionif no such mapping exists.- Specified by:
getOrThrowin interfaceCharByteMap- Parameters:
key- the key- Returns:
- the value associated with the key
-
containsKey
public boolean containsKey(char key)
Description copied from interface:CharByteMapReturns whether or not the key is present in the map.- Specified by:
containsKeyin interfaceCharByteMap- Parameters:
key- the key- Returns:
- if a mapping exists in this map for the key
-
containsValue
public boolean containsValue(byte value)
Description copied from interface:ByteValuesMapReturns whether or not this map contains the value.- Specified by:
containsValuein interfaceByteValuesMap- Parameters:
value- the value to test- Returns:
- if this collection contains the value
-
forEachValue
public void forEachValue(ByteProcedure procedure)
Description copied from interface:ByteValuesMapIterates through each value in this map.- Specified by:
forEachValuein interfaceByteValuesMap- Parameters:
procedure- the procedure to invoke for each value in this map.
-
forEachKey
public void forEachKey(CharProcedure procedure)
Description copied from interface:CharByteMapIterates through each key in the map, invoking the procedure for each.- Specified by:
forEachKeyin interfaceCharByteMap- Parameters:
procedure- the procedure to invoke for each key
-
forEachKeyValue
public void forEachKeyValue(CharByteProcedure procedure)
Description copied from interface:CharByteMapIterates through each key/value pair in the map, invoking the procedure for each.- Specified by:
forEachKeyValuein interfaceCharByteMap- Parameters:
procedure- the procedure to invoke for each key/value pair
-
allSatisfyKeyValue
public boolean allSatisfyKeyValue(CharBytePredicate predicate)
- Specified by:
allSatisfyKeyValuein interfaceCharByteMap- Since:
- 12.0
-
keysView
public LazyCharIterable keysView()
Description copied from interface:CharByteMapReturns a view of the keys in this map. This iterable is backed by the map, so any modifications to the underlying map will be reflected in the keys returned by the iterable.- Specified by:
keysViewin interfaceCharByteMap- Returns:
- a view of the keys in this map
-
keyValuesView
public RichIterable<CharBytePair> keyValuesView()
Description copied from interface:CharByteMapReturns a view of the key/value pairs in this map. This iterable is backed by the map, so any modifications to the underlying map will be reflected in the pairs returned by the iterable.- Specified by:
keyValuesViewin interfaceCharByteMap- Returns:
- a view of the keys in this map
-
flipUniqueValues
public ImmutableByteCharMap flipUniqueValues()
Description copied from interface:CharByteMapReturn the ByteCharMap that is obtained by flipping the direction of this map and making the associations from value to key.- Specified by:
flipUniqueValuesin interfaceCharByteMap- Specified by:
flipUniqueValuesin interfaceImmutableCharByteMap
-
select
public ImmutableCharByteMap select(CharBytePredicate predicate)
Description copied from interface:CharByteMapReturn a copy of this map containing only the key/value pairs that match the predicate.- Specified by:
selectin interfaceCharByteMap- Specified by:
selectin interfaceImmutableCharByteMap- Parameters:
predicate- the predicate to determine which key/value pairs in this map should be included in the returned map- Returns:
- a copy of this map with the matching key/value pairs
-
reject
public ImmutableCharByteMap reject(CharBytePredicate predicate)
Description copied from interface:CharByteMapReturn a copy of this map containing only the key/value pairs that do not match the predicate.- Specified by:
rejectin interfaceCharByteMap- Specified by:
rejectin interfaceImmutableCharByteMap- Parameters:
predicate- the predicate to determine which key/value pairs in this map should be excluded from the returned map- Returns:
- a copy of this map without the matching key/value pairs
-
injectInto
public <T> T injectInto(T injectedValue, ObjectByteToObjectFunction<? super T,? extends T> function)- Specified by:
injectIntoin interfaceByteIterable
-
chunk
public RichIterable<ByteIterable> chunk(int size)
Description copied from interface:ByteIterablePartitions elements in fixed size chunks.- Specified by:
chunkin interfaceByteIterable- Parameters:
size- the number of elements per chunk- Returns:
- A
RichIterablecontainingByteIterables of sizesize, except the last will be truncated if the elements don't divide evenly.
-
toImmutable
public ImmutableCharByteMap toImmutable()
Description copied from interface:CharByteMapReturns a copy of this map that is immutable (if this map is mutable) or itself if it is already immutable.- Specified by:
toImmutablein interfaceCharByteMap- Returns:
- an immutable map that is equivalent to this one
-
byteIterator
public ByteIterator byteIterator()
Description copied from interface:ByteIterableReturns a primitive iterator that can be used to iterate over the ByteIterable in an imperative style.- Specified by:
byteIteratorin interfaceByteIterable
-
each
public void each(ByteProcedure procedure)
Description copied from interface:ByteIterableA synonym for forEach.- Specified by:
eachin interfaceByteIterable- Since:
- 7.0.
-
count
public int count(BytePredicate predicate)
Description copied from interface:ByteIterableReturns a count of the number of elements in the ByteIterable that return true for the specified predicate.- Specified by:
countin interfaceByteIterable
-
sum
public long sum()
- Specified by:
sumin interfaceByteIterable
-
min
public byte min()
- Specified by:
minin interfaceByteIterable
-
max
public byte max()
- Specified by:
maxin interfaceByteIterable
-
maxIfEmpty
public byte maxIfEmpty(byte defaultValue)
- Specified by:
maxIfEmptyin interfaceByteIterable
-
minIfEmpty
public byte minIfEmpty(byte defaultValue)
- Specified by:
minIfEmptyin interfaceByteIterable
-
average
public double average()
- Specified by:
averagein interfaceByteIterable
-
median
public double median()
- Specified by:
medianin interfaceByteIterable
-
toSortedArray
public byte[] toSortedArray()
- Specified by:
toSortedArrayin interfaceByteIterable
-
toSortedList
public MutableByteList toSortedList()
- Specified by:
toSortedListin interfaceByteIterable
-
anySatisfy
public boolean anySatisfy(BytePredicate predicate)
Description copied from interface:ByteIterableReturns true if any of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
anySatisfyin interfaceByteIterable
-
allSatisfy
public boolean allSatisfy(BytePredicate predicate)
Description copied from interface:ByteIterableReturns true if all of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
allSatisfyin interfaceByteIterable
-
noneSatisfy
public boolean noneSatisfy(BytePredicate predicate)
Description copied from interface:ByteIterableReturns true if none of the elements in the ByteIterable return true for the specified predicate, otherwise returns false.- Specified by:
noneSatisfyin interfaceByteIterable
-
select
public ImmutableByteBag select(BytePredicate predicate)
Description copied from interface:ByteIterableReturns a new ByteIterable with all of the elements in the ByteIterable that return true for the specified predicate.- Specified by:
selectin interfaceByteIterable- Specified by:
selectin interfaceByteValuesMap- Specified by:
selectin interfaceImmutableCharByteMap
-
reject
public ImmutableByteBag reject(BytePredicate predicate)
Description copied from interface:ByteIterableReturns a new ByteIterable with all of the elements in the ByteIterable that return false for the specified predicate.- Specified by:
rejectin interfaceByteIterable- Specified by:
rejectin interfaceByteValuesMap- Specified by:
rejectin interfaceImmutableCharByteMap
-
collect
public <V> ImmutableBag<V> collect(ByteToObjectFunction<? extends V> function)
Description copied from interface:ByteIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collectin interfaceByteIterable- Specified by:
collectin interfaceByteValuesMap- Specified by:
collectin interfaceImmutableCharByteMap
-
detectIfNone
public byte detectIfNone(BytePredicate predicate, byte ifNone)
- Specified by:
detectIfNonein interfaceByteIterable
-
toArray
public byte[] toArray()
Description copied from interface:ByteIterableConverts the ByteIterable to a primitive byte array.- Specified by:
toArrayin interfaceByteIterable
-
toArray
public byte[] toArray(byte[] target)
Description copied from interface:ByteIterableConverts the ByteIterable to a primitive byte array. If the collection fits into the provided array it is used to store its elements and is returned from the method, otherwise a new array of the appropriate size is allocated and returned. If the iterable is empty, the target array is returned unchanged.- Specified by:
toArrayin interfaceByteIterable
-
contains
public boolean contains(byte value)
Description copied from interface:ByteIterableReturns true if the value is contained in the ByteIterable, and false if it is not.- Specified by:
containsin interfaceByteIterable
-
containsAll
public boolean containsAll(byte... source)
Description copied from interface:ByteIterableReturns true if all of the values specified in the source array are contained in the ByteIterable, and false if they are not.- Specified by:
containsAllin interfaceByteIterable
-
containsAll
public boolean containsAll(ByteIterable source)
Description copied from interface:ByteIterableReturns true if all of the values specified in the source ByteIterable are contained in the ByteIterable, and false if they are not.- Specified by:
containsAllin interfaceByteIterable
-
toList
public MutableByteList toList()
Description copied from interface:ByteIterableConverts the ByteIterable to a new MutableByteList.- Specified by:
toListin interfaceByteIterable
-
toSet
public MutableByteSet toSet()
Description copied from interface:ByteIterableConverts the ByteIterable to a new MutableByteSet.- Specified by:
toSetin interfaceByteIterable
-
toBag
public MutableByteBag toBag()
Description copied from interface:ByteIterableConverts the ByteIterable to a new MutableByteBag.- Specified by:
toBagin interfaceByteIterable
-
asLazy
public LazyByteIterable asLazy()
Description copied from interface:ByteIterableReturns a LazyByteIterable adapter wrapping the source ByteIterable.- Specified by:
asLazyin interfaceByteIterable
-
newWithKeyValue
public ImmutableCharByteMap newWithKeyValue(char key, byte value)
Description copied from interface:ImmutableCharByteMapCopy this map, associate the value with the key (replacing the value if one already exists forkey), and return the copy as new immutable map. A copy is always made even ifkeyis already associated withvalue.- Specified by:
newWithKeyValuein interfaceImmutableCharByteMap- Parameters:
key- the key to addvalue- the value to associate with the key in the copy- Returns:
- an immutable copy of this map with
valueassociated withkey
-
newWithoutKey
public ImmutableCharByteMap newWithoutKey(char key)
Description copied from interface:ImmutableCharByteMapCopy this map, remove any associated value with the key (if one exists), and return the copy as a new immutable map.- Specified by:
newWithoutKeyin interfaceImmutableCharByteMap- Parameters:
key- the key to remove- Returns:
- an immutable copy of this map with
keyremoved
-
newWithoutAllKeys
public ImmutableCharByteMap newWithoutAllKeys(CharIterable keys)
Description copied from interface:ImmutableCharByteMapCopy this map, remove any associated values with the specified keys (if any exist), and return the copy as a new immutable map.- Specified by:
newWithoutAllKeysin interfaceImmutableCharByteMap- Parameters:
keys- the keys to remove- Returns:
- an immutable copy of this map with all keys in
keysremoved
-
size
public int size()
Description copied from interface:PrimitiveIterableReturns the number of items in this iterable.- Specified by:
sizein interfacePrimitiveIterable
-
isEmpty
public boolean isEmpty()
Description copied from interface:PrimitiveIterableReturns true if this iterable has zero items.- Specified by:
isEmptyin interfacePrimitiveIterable
-
notEmpty
public boolean notEmpty()
Description copied from interface:PrimitiveIterableThe English equivalent of !this.isEmpty()- Specified by:
notEmptyin interfacePrimitiveIterable
-
keySet
public MutableCharSet keySet()
Description copied from interface:CharByteMapReturns a set containing all the keys in this map. The set is backed by the map, so any modifications to the returned set will affect this map.- Specified by:
keySetin interfaceCharByteMap- Returns:
- a mutable set containing the keys in this map
-
values
public MutableByteCollection values()
Description copied from interface:ByteValuesMapReturns the values in this map as a separate collection. The returned collection is backed by the map, so any changes made to the returned collection will affect the state of this map.- Specified by:
valuesin interfaceByteValuesMap- Returns:
- the values as a collection backed by this map
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:CharByteMapFollows the same general contract asMap.equals(Object).- Specified by:
equalsin interfaceCharByteMap- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:CharByteMapFollows the same general contract asMap.hashCode().- Specified by:
hashCodein interfaceCharByteMap- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Description copied from interface:CharByteMapFollows the same general contract asAbstractMap.toString()- Specified by:
toStringin interfaceCharByteMap- Specified by:
toStringin interfacePrimitiveIterable- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this CharByteMap
- See Also:
AbstractCollection.toString()
-
makeString
public java.lang.String makeString()
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String)and defaulting the separator parameter to the characters", "(comma and space).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String separator)
Description copied from interface:PrimitiveIterableReturns a string representation of this collection by delegating toPrimitiveIterable.makeString(String, String, String)and defaulting the start and end parameters to""(the empty String).- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
makeString
public java.lang.String makeString(java.lang.String start, java.lang.String separator, java.lang.String end)Description copied from interface:PrimitiveIterableReturns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.- Specified by:
makeStringin interfacePrimitiveIterable- Returns:
- a string representation of this collection.
-
appendString
public void appendString(java.lang.Appendable appendable)
Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString().- Specified by:
appendStringin interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String separator)Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String).- Specified by:
appendStringin interfacePrimitiveIterable
-
appendString
public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)Description copied from interface:PrimitiveIterablePrints a string representation of this collection onto the givenAppendable. Prints the string returned byPrimitiveIterable.makeString(String, String, String).- Specified by:
appendStringin interfacePrimitiveIterable
-
-