java.io.Externalizable
, java.io.Serializable
, CharBag
, MutableCharBag
, CharIterable
, MutableCharCollection
, PrimitiveIterable
public class CharHashBag extends AbstractCharIterable implements MutableCharBag, java.io.Externalizable
HashBag
, and is memory-optimized for char primitives.
This file was automatically generated from template file primitiveHashBag.stg.Constructor | Description |
---|---|
CharHashBag() |
|
CharHashBag(char... elements) |
|
CharHashBag(int size) |
|
CharHashBag(CharIterable iterable) |
|
CharHashBag(CharHashBag bag) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(char item) |
|
boolean |
addAll(char... source) |
|
boolean |
addAll(CharIterable source) |
|
void |
addOccurrences(char item,
int occurrences) |
|
boolean |
allSatisfy(CharPredicate predicate) |
Returns true if all of the elements in the CharIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
anySatisfy(CharPredicate predicate) |
Returns true if any of the elements in the CharIterable return true for the
specified predicate, otherwise returns false.
|
void |
appendString(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 given
Appendable . |
MutableCharBag |
asSynchronized() |
|
MutableCharBag |
asUnmodifiable() |
|
MutableList<CharIntPair> |
bottomOccurrences(int count) |
Returns the
count least frequently occurring items. |
MutableCharIterator |
charIterator() |
Returns a primitive iterator that can be used to iterate over the CharIterable in an
imperative style.
|
RichIterable<CharIterable> |
chunk(int size) |
Partitions elements in fixed size chunks.
|
void |
clear() |
|
<V> MutableBag<V> |
collect(CharToObjectFunction<? extends V> function) |
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
boolean |
contains(char value) |
Returns true if the value is contained in the CharIterable, and false if it is not.
|
int |
count(CharPredicate predicate) |
Returns a count of the number of elements in the CharIterable that return true for the
specified predicate.
|
char |
detectIfNone(CharPredicate predicate,
char ifNone) |
|
void |
each(CharProcedure procedure) |
A synonym for forEach.
|
boolean |
equals(java.lang.Object otherBag) |
Follows the same general contract as
Bag.equals(Object) . |
void |
forEach(CharProcedure procedure) |
Applies the CharProcedure to each element in the CharIterable.
|
void |
forEachWithOccurrences(CharIntProcedure procedure) |
For each distinct item, with the number of occurrences, execute the specified procedure.
|
int |
hashCode() |
Follows the same general contract as
Bag.hashCode() . |
<T> T |
injectInto(T injectedValue,
ObjectCharToObjectFunction<? super T,? extends T> function) |
|
boolean |
isEmpty() |
Returns true if this iterable has zero items.
|
char |
max() |
|
char |
min() |
|
static CharHashBag |
newBag(int size) |
|
static CharHashBag |
newBag(CharBag source) |
|
static CharHashBag |
newBag(CharIterable source) |
|
static CharHashBag |
newBagWith(char... source) |
|
CharHashBag |
newEmpty() |
Creates a new empty CharHashBag.
|
boolean |
noneSatisfy(CharPredicate predicate) |
Returns true if none of the elements in the CharIterable return true for the
specified predicate, otherwise returns false.
|
boolean |
notEmpty() |
The English equivalent of !this.isEmpty()
|
int |
occurrencesOf(char item) |
The occurrences of a distinct item in the bag.
|
void |
readExternal(java.io.ObjectInput in) |
|
CharHashBag |
reject(CharPredicate predicate) |
Returns a new CharIterable with all of the elements in the CharIterable that
return false for the specified predicate.
|
boolean |
remove(char item) |
|
boolean |
removeAll(char... source) |
|
boolean |
removeAll(CharIterable source) |
|
boolean |
removeIf(CharPredicate predicate) |
|
boolean |
removeOccurrences(char item,
int occurrences) |
|
boolean |
retainAll(char... source) |
|
boolean |
retainAll(CharIterable source) |
|
CharHashBag |
select(CharPredicate predicate) |
Returns a new CharIterable with all of the elements in the CharIterable that
return true for the specified predicate.
|
CharHashBag |
selectByOccurrences(IntPredicate predicate) |
Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
|
MutableCharSet |
selectUnique() |
Returns all elements of the bag that have exactly one occurrence.
|
int |
size() |
Returns the number of items in this iterable.
|
int |
sizeDistinct() |
The size of the Bag when counting only distinct elements.
|
long |
sum() |
|
char[] |
toArray() |
Converts the CharIterable to a primitive char array.
|
ImmutableCharBag |
toImmutable() |
Returns an immutable copy of this bag.
|
MutableList<CharIntPair> |
topOccurrences(int count) |
Returns the
count most frequently occurring items. |
CharHashBag |
with(char element) |
|
CharHashBag |
with(char element1,
char element2) |
|
CharHashBag |
with(char element1,
char element2,
char element3) |
|
CharHashBag |
withAll(CharIterable iterable) |
|
CharHashBag |
without(char element) |
|
CharHashBag |
withoutAll(CharIterable iterable) |
|
void |
writeExternal(java.io.ObjectOutput out) |
asLazy, average, containsAll, containsAll, maxIfEmpty, median, minIfEmpty, toBag, toList, toSet, toSortedArray, toSortedList, toString
toStringOfItemToCount
asLazy, average, averageIfEmpty, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAll, containsAll, flatCollect, maxIfEmpty, median, medianIfEmpty, minIfEmpty, reject, select, summaryStatistics, toBag, toList, toSet, toSortedArray, toSortedList
selectDuplicates, tap
appendString, appendString, makeString, makeString, makeString, toString
public CharHashBag()
public CharHashBag(int size)
public CharHashBag(CharIterable iterable)
public CharHashBag(char... elements)
public CharHashBag(CharHashBag bag)
public static CharHashBag newBag(int size)
public static CharHashBag newBagWith(char... source)
public static CharHashBag newBag(CharIterable source)
public static CharHashBag newBag(CharBag source)
public boolean isEmpty()
PrimitiveIterable
isEmpty
in interface PrimitiveIterable
public boolean notEmpty()
PrimitiveIterable
notEmpty
in interface PrimitiveIterable
public int size()
PrimitiveIterable
size
in interface PrimitiveIterable
public int sizeDistinct()
CharBag
sizeDistinct
in interface CharBag
public void clear()
clear
in interface MutableCharCollection
public CharHashBag with(char element)
with
in interface MutableCharBag
with
in interface MutableCharCollection
public CharHashBag with(char element1, char element2)
public CharHashBag with(char element1, char element2, char element3)
public CharHashBag withAll(CharIterable iterable)
withAll
in interface MutableCharBag
withAll
in interface MutableCharCollection
public CharHashBag without(char element)
without
in interface MutableCharBag
without
in interface MutableCharCollection
public CharHashBag withoutAll(CharIterable iterable)
withoutAll
in interface MutableCharBag
withoutAll
in interface MutableCharCollection
public boolean contains(char value)
CharIterable
contains
in interface CharIterable
public int occurrencesOf(char item)
CharBag
occurrencesOf
in interface CharBag
public void forEachWithOccurrences(CharIntProcedure procedure)
CharBag
forEachWithOccurrences
in interface CharBag
public CharHashBag selectByOccurrences(IntPredicate predicate)
MutableCharBag
selectByOccurrences
in interface CharBag
selectByOccurrences
in interface MutableCharBag
public MutableCharSet selectUnique()
MutableCharBag
selectUnique
in interface CharBag
selectUnique
in interface MutableCharBag
public MutableList<CharIntPair> topOccurrences(int count)
MutableCharBag
count
most frequently occurring items.
In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last
item will be returned.topOccurrences
in interface CharBag
topOccurrences
in interface MutableCharBag
public MutableList<CharIntPair> bottomOccurrences(int count)
MutableCharBag
count
least frequently occurring items.
In the event of a tie, all of the items with the number of occurrences that match the occurrences of the last
item will be returned.bottomOccurrences
in interface CharBag
bottomOccurrences
in interface MutableCharBag
public boolean add(char item)
add
in interface MutableCharCollection
public boolean remove(char item)
remove
in interface MutableCharCollection
public boolean removeIf(CharPredicate predicate)
removeIf
in interface MutableCharCollection
public boolean addAll(char... source)
addAll
in interface MutableCharCollection
public boolean addAll(CharIterable source)
addAll
in interface MutableCharCollection
public boolean removeAll(char... source)
removeAll
in interface MutableCharCollection
public boolean removeAll(CharIterable source)
removeAll
in interface MutableCharCollection
public boolean retainAll(CharIterable source)
retainAll
in interface MutableCharCollection
Collection.retainAll(Collection)
public boolean retainAll(char... source)
retainAll
in interface MutableCharCollection
Collection.retainAll(Collection)
public void addOccurrences(char item, int occurrences)
addOccurrences
in interface MutableCharBag
public boolean removeOccurrences(char item, int occurrences)
removeOccurrences
in interface MutableCharBag
public void forEach(CharProcedure procedure)
CharIterable
forEach
in interface CharIterable
public void each(CharProcedure procedure)
CharIterable
each
in interface CharIterable
public CharHashBag select(CharPredicate predicate)
CharIterable
select
in interface CharBag
select
in interface CharIterable
select
in interface MutableCharBag
select
in interface MutableCharCollection
public CharHashBag reject(CharPredicate predicate)
CharIterable
reject
in interface CharBag
reject
in interface CharIterable
reject
in interface MutableCharBag
reject
in interface MutableCharCollection
public <T> T injectInto(T injectedValue, ObjectCharToObjectFunction<? super T,? extends T> function)
injectInto
in interface CharIterable
public RichIterable<CharIterable> chunk(int size)
CharIterable
chunk
in interface CharIterable
size
- the number of elements per chunkRichIterable
containing CharIterable
s of size size
, except the last will be
truncated if the elements don't divide evenly.public boolean equals(java.lang.Object otherBag)
CharBag
Bag.equals(Object)
.public int hashCode()
CharBag
Bag.hashCode()
.public void appendString(java.lang.Appendable appendable, java.lang.String start, java.lang.String separator, java.lang.String end)
PrimitiveIterable
Appendable
. Prints the string returned
by PrimitiveIterable.makeString(String, String, String)
.appendString
in interface PrimitiveIterable
public int count(CharPredicate predicate)
CharIterable
count
in interface CharIterable
public boolean anySatisfy(CharPredicate predicate)
CharIterable
anySatisfy
in interface CharIterable
public boolean allSatisfy(CharPredicate predicate)
CharIterable
allSatisfy
in interface CharIterable
public boolean noneSatisfy(CharPredicate predicate)
CharIterable
noneSatisfy
in interface CharIterable
public char detectIfNone(CharPredicate predicate, char ifNone)
detectIfNone
in interface CharIterable
public <V> MutableBag<V> collect(CharToObjectFunction<? extends V> function)
CharIterable
collect
in interface CharBag
collect
in interface CharIterable
collect
in interface MutableCharBag
collect
in interface MutableCharCollection
public char max()
max
in interface CharIterable
public char min()
min
in interface CharIterable
public long sum()
sum
in interface CharIterable
public char[] toArray()
CharIterable
toArray
in interface CharIterable
public MutableCharBag asUnmodifiable()
asUnmodifiable
in interface MutableCharBag
asUnmodifiable
in interface MutableCharCollection
public MutableCharBag asSynchronized()
asSynchronized
in interface MutableCharBag
asSynchronized
in interface MutableCharCollection
public ImmutableCharBag toImmutable()
MutableCharBag
toImmutable
in interface CharBag
toImmutable
in interface MutableCharBag
toImmutable
in interface MutableCharCollection
public CharHashBag newEmpty()
newEmpty
in interface MutableCharBag
newEmpty
in interface MutableCharCollection
public MutableCharIterator charIterator()
CharIterable
charIterator
in interface CharIterable
charIterator
in interface MutableCharCollection
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
readExternal
in interface java.io.Externalizable
java.io.IOException
Copyright © 2004–2018. All rights reserved.