Class AbstractCharStack

java.lang.Object
org.eclipse.collections.impl.stack.primitive.AbstractCharStack
All Implemented Interfaces:
CharIterable, OrderedCharIterable, PrimitiveIterable, CharStack
Direct Known Subclasses:
CharArrayStack, ImmutableCharArrayStack

public abstract class AbstractCharStack extends Object implements CharStack
This file was automatically generated from template file abstractPrimitiveStack.stg.
  • Constructor Details

    • AbstractCharStack

      public AbstractCharStack()
  • Method Details

    • getDelegate

      protected abstract CharArrayList getDelegate()
    • checkEmptyStack

      protected void checkEmptyStack()
    • peek

      public char peek()
      Description copied from interface: CharStack
      Returns the top of the stack.
      Specified by:
      peek in interface CharStack
    • peek

      public CharList peek(int count)
      Description copied from interface: CharStack
      Returns CharList of the number of elements specified by the count, beginning with the top of the stack.
      Specified by:
      peek in interface CharStack
    • peekAt

      public char peekAt(int index)
      Description copied from interface: CharStack
      Returns the element at the specified index.
      Specified by:
      peekAt in interface CharStack
      Parameters:
      index - the location to peek into
    • rangeCheck

      protected void rangeCheck(int index)
    • checkPositiveValueForCount

      protected void checkPositiveValueForCount(int count)
    • checkSizeLessThanCount

      protected void checkSizeLessThanCount(int count)
    • charIterator

      public CharIterator charIterator()
      Description copied from interface: CharIterable
      Returns a primitive iterator that can be used to iterate over the CharIterable in an imperative style.
      Specified by:
      charIterator in interface CharIterable
    • each

      public void each(CharProcedure procedure)
      Description copied from interface: CharIterable
      A synonym for forEach.
      Specified by:
      each in interface CharIterable
      Since:
      7.0.
    • count

      public int count(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns a count of the number of elements in the CharIterable that return true for the specified predicate.
      Specified by:
      count in interface CharIterable
    • anySatisfy

      public boolean anySatisfy(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns true if any of the elements in the CharIterable return true for the specified predicate, otherwise returns false.
      Specified by:
      anySatisfy in interface CharIterable
    • allSatisfy

      public boolean allSatisfy(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns true if all of the elements in the CharIterable return true for the specified predicate, otherwise returns false.
      Specified by:
      allSatisfy in interface CharIterable
    • noneSatisfy

      public boolean noneSatisfy(CharPredicate predicate)
      Description copied from interface: CharIterable
      Returns true if none of the elements in the CharIterable return true for the specified predicate, otherwise returns false.
      Specified by:
      noneSatisfy in interface CharIterable
    • detectIfNone

      public char detectIfNone(CharPredicate predicate, char ifNone)
      Specified by:
      detectIfNone in interface CharIterable
    • toArray

      public char[] toArray()
      Description copied from interface: CharIterable
      Converts the CharIterable to a primitive char array.
      Specified by:
      toArray in interface CharIterable
    • toArray

      public char[] toArray(char[] target)
      Description copied from interface: CharIterable
      Converts the CharIterable to a primitive char 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:
      toArray in interface CharIterable
    • contains

      public boolean contains(char value)
      Description copied from interface: CharIterable
      Returns true if the value is contained in the CharIterable, and false if it is not.
      Specified by:
      contains in interface CharIterable
    • containsAll

      public boolean containsAll(char... source)
      Description copied from interface: CharIterable
      Returns true if all of the values specified in the source array are contained in the CharIterable, and false if they are not.
      Specified by:
      containsAll in interface CharIterable
    • containsAll

      public boolean containsAll(CharIterable source)
      Description copied from interface: CharIterable
      Returns true if all of the values specified in the source CharIterable are contained in the CharIterable, and false if they are not.
      Specified by:
      containsAll in interface CharIterable
    • toList

      public MutableCharList toList()
      Description copied from interface: CharIterable
      Converts the CharIterable to a new MutableCharList.
      Specified by:
      toList in interface CharIterable
    • toSet

      public MutableCharSet toSet()
      Description copied from interface: CharIterable
      Converts the CharIterable to a new MutableCharSet.
      Specified by:
      toSet in interface CharIterable
    • toBag

      public MutableCharBag toBag()
      Description copied from interface: CharIterable
      Converts the CharIterable to a new MutableCharBag.
      Specified by:
      toBag in interface CharIterable
    • injectInto

      public <V> V injectInto(V injectedValue, ObjectCharToObjectFunction<? super V,? extends V> function)
      Specified by:
      injectInto in interface CharIterable
    • asLazy

      public LazyCharIterable asLazy()
      Description copied from interface: CharIterable
      Returns a LazyCharIterable adapter wrapping the source CharIterable.
      Specified by:
      asLazy in interface CharIterable
    • size

      public int size()
      Description copied from interface: PrimitiveIterable
      Returns the number of items in this iterable.
      Specified by:
      size in interface PrimitiveIterable
    • equals

      public boolean equals(Object otherStack)
      Description copied from interface: CharStack
      Follows the same general contract as StackIterable.equals(Object).
      Specified by:
      equals in interface CharStack
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Description copied from interface: CharStack
      Follows the same general contract as StackIterable.hashCode().
      Specified by:
      hashCode in interface CharStack
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Description copied from interface: PrimitiveIterable
      Returns a string with the elements of this iterable separated by commas with spaces and enclosed in square brackets.
       Assert.assertEquals("[]", IntLists.mutable.empty().toString());
       Assert.assertEquals("[1]", IntLists.mutable.with(1).toString());
       Assert.assertEquals("[1, 2, 3]", IntLists.mutable.with(1, 2, 3).toString());
       
      Specified by:
      toString in interface PrimitiveIterable
      Overrides:
      toString in class Object
      Returns:
      a string representation of this PrimitiveIterable
      See Also:
    • makeString

      public String makeString()
      Description copied from interface: PrimitiveIterable
      Returns a string representation of this collection by delegating to PrimitiveIterable.makeString(String) and defaulting the separator parameter to the characters ", " (comma and space).
      Specified by:
      makeString in interface PrimitiveIterable
      Returns:
      a string representation of this collection.
    • makeString

      public String makeString(String separator)
      Description copied from interface: PrimitiveIterable
      Returns a string representation of this collection by delegating to PrimitiveIterable.makeString(String, String, String) and defaulting the start and end parameters to "" (the empty String).
      Specified by:
      makeString in interface PrimitiveIterable
      Returns:
      a string representation of this collection.
    • makeString

      public String makeString(String start, String separator, String end)
      Description copied from interface: PrimitiveIterable
      Returns a string representation of this collection with the elements separated by the specified separator and enclosed between the start and end strings.
      Specified by:
      makeString in interface PrimitiveIterable
      Returns:
      a string representation of this collection.
    • appendString

      public void appendString(Appendable appendable)
      Description copied from interface: PrimitiveIterable
      Prints a string representation of this collection onto the given Appendable. Prints the string returned by PrimitiveIterable.makeString().
      Specified by:
      appendString in interface PrimitiveIterable
    • appendString

      public void appendString(Appendable appendable, String separator)
      Description copied from interface: PrimitiveIterable
      Prints a string representation of this collection onto the given Appendable. Prints the string returned by PrimitiveIterable.makeString(String).
      Specified by:
      appendString in interface PrimitiveIterable
    • appendString

      public void appendString(Appendable appendable, String start, String separator, String end)
      Description copied from interface: PrimitiveIterable
      Prints a string representation of this collection onto the given Appendable. Prints the string returned by PrimitiveIterable.makeString(String, String, String).
      Specified by:
      appendString in interface PrimitiveIterable
    • getFirst

      public char getFirst()
      Specified by:
      getFirst in interface OrderedCharIterable
    • indexOf

      public int indexOf(char value)
      Specified by:
      indexOf in interface OrderedCharIterable
    • injectIntoWithIndex

      public <T> T injectIntoWithIndex(T injectedValue, ObjectCharIntToObjectFunction<? super T,? extends T> function)
      Specified by:
      injectIntoWithIndex in interface OrderedCharIterable
    • forEachWithIndex

      public void forEachWithIndex(CharIntProcedure procedure)
      Specified by:
      forEachWithIndex in interface OrderedCharIterable
    • chunk

      public RichIterable<CharIterable> chunk(int size)
      Description copied from interface: CharIterable
      Partitions elements in fixed size chunks.
      Specified by:
      chunk in interface CharIterable
      Parameters:
      size - the number of elements per chunk
      Returns:
      A RichIterable containing CharIterables of size size, except the last will be truncated if the elements don't divide evenly.
    • sum

      public long sum()
      Specified by:
      sum in interface CharIterable
    • max

      public char max()
      Specified by:
      max in interface CharIterable
    • min

      public char min()
      Specified by:
      min in interface CharIterable
    • minIfEmpty

      public char minIfEmpty(char defaultValue)
      Specified by:
      minIfEmpty in interface CharIterable
    • maxIfEmpty

      public char maxIfEmpty(char defaultValue)
      Specified by:
      maxIfEmpty in interface CharIterable
    • average

      public double average()
      Specified by:
      average in interface CharIterable
    • median

      public double median()
      Specified by:
      median in interface CharIterable
    • toSortedArray

      public char[] toSortedArray()
      Specified by:
      toSortedArray in interface CharIterable