Class ShortIntHashMap.KeyValuesView

    • Constructor Detail

      • KeyValuesView

        private KeyValuesView()
    • Method Detail

      • each

        public void each​(Procedure<? super ShortIntPair> procedure)
        Description copied from interface: RichIterable
        The procedure is executed for each element in the iterable.

        Example using a Java 8 lambda expression:

         people.each(person -> LOGGER.info(person.getName()));
         

        Example using an anonymous inner class:

         people.each(new Procedure<Person>()
         {
             public void value(Person person)
             {
                 LOGGER.info(person.getName());
             }
         });
         
        This method is a variant of InternalIterable.forEach(Procedure) that has a signature conflict with Iterable.forEach(java.util.function.Consumer).
        See Also:
        InternalIterable.forEach(Procedure), Iterable.forEach(java.util.function.Consumer)
      • forEachWithIndex

        public void forEachWithIndex​(ObjectIntProcedure<? super ShortIntPair> objectIntProcedure)
        Description copied from interface: InternalIterable
        Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

        Example using a Java 8 lambda:

         people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
         

        Example using an anonymous inner class:

         people.forEachWithIndex(new ObjectIntProcedure<Person>()
         {
             public void value(Person person, int index)
             {
                 LOGGER.info("Index: " + index + " person: " + person.getName());
             }
         });
         
        Specified by:
        forEachWithIndex in interface InternalIterable<ShortIntPair>
        Overrides:
        forEachWithIndex in class AbstractRichIterable<ShortIntPair>
      • forEachWith

        public <P> void forEachWith​(Procedure2<? super ShortIntPair,​? super P> procedure,
                                    P parameter)
        Description copied from interface: InternalIterable
        The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

        Example using a Java 8 lambda:

         people.forEachWith((Person person, Person other) ->
             {
                 if (person.isRelatedTo(other))
                 {
                      LOGGER.info(person.getName());
                 }
             }, fred);
         

        Example using an anonymous inner class:

         people.forEachWith(new Procedure2<Person, Person>()
         {
             public void value(Person person, Person other)
             {
                 if (person.isRelatedTo(other))
                 {
                      LOGGER.info(person.getName());
                 }
             }
         }, fred);
         
        Specified by:
        forEachWith in interface InternalIterable<ShortIntPair>
        Overrides:
        forEachWith in class AbstractRichIterable<ShortIntPair>
      • iterator

        public java.util.Iterator<ShortIntPair> iterator()