public
interface
Iterable
| java.lang.Iterable<T> |
Collection
interface, to minimize the effort required to implement this interface.
List
interface to minimize the effort required to implement this interface
backed by a "random access" data store (such as an array).
Queue
operations.
List
interface to minimize the effort required to implement this interface
backed by a "sequential access" data store (such as a linked list).
Set
interface to minimize the effort required to implement this
interface.
AlphabeticIndex.
Deque interface.
List interface.
HashSet.
SQLException thrown when an error
occurs during a batch update operation.
Deque that additionally supports blocking operations that wait
for the deque to become non-empty when retrieving an element, and wait for
space to become available in the deque when storing an element.
Queue that additionally supports operations that wait for
the queue to become non-empty when retrieving an element, and wait
for space to become available in the queue when storing an element.
Set of keys, in
which additions may optionally be enabled by mapping to a
common value.
NavigableSet implementation based on
a ConcurrentSkipListMap.
ArrayList in which all mutative
operations (add, set, and so on) are implemented by
making a fresh copy of the underlying array.
Set that uses an internal CopyOnWriteArrayList
for all of its operations.
DataTruncation exception
(on writes) or reported as a
DataTruncation warning (on reads)
when a data values is unexpectedly truncated for reasons other than its having
execeeded MaxFieldSize.
Delayed
elements, in which an element generally becomes eligible for removal when its
delay has expired.
Set implementation for use with enum types.
Set interface, backed by a hash table
(actually a HashMap instance).
Set interface,
with well-defined encounter order.
List and Deque
interfaces.
TransferQueue based on linked nodes.
SortedSet extended with navigation methods reporting
closest matches for given search targets.
PriorityQueue and supplies
blocking retrieval operations.
SQLException is thrown when one or more client info properties
could not be set on a Connection.
SQLException thrown when the SQLState class value
is '22', or under vendor-specified conditions.
SQLException thrown when the SQLState class value is '0A'
( the value is 'zero' A).
SQLException thrown when the SQLState class value
is '23', or under vendor-specified conditions.
SQLException thrown when the SQLState class value
is '28', or under vendor-specified conditions.
SQLException thrown for the SQLState
class value '08', or under vendor-specified conditions.
SQLException thrown when an instance where a retry
of the same operation would fail unless the cause of the SQLException
is corrected.
SQLException thrown in situations where a
previously failed operation might be able to succeed if the application performs
some recovery steps and retries the entire transaction or in the case of a
distributed transaction, the transaction branch.
SQLException thrown when the SQLState class value
is '42', or under vendor-specified conditions.
The subclass of SQLException thrown when the timeout specified by Statement
has expired.
SQLException thrown when the SQLState class value
is '40', or under vendor-specified conditions.
SQLException for the SQLState class
value '08', or under vendor-specified conditions.
SQLException is thrown in situations where a
previoulsy failed operation might be able to succeed when the operation is
retried without any intervention by application-level functionality.
An exception that provides information on database access warnings.
DirectoryStream that defines operations on files that are located
relative to an open directory.
SequencedCollection and a Set.
Set that further provides a total ordering on its elements.
Stack class represents a last-in-first-out
(LIFO) stack of objects.
BlockingQueue in which producers may wait for consumers
to receive elements.
NavigableSet implementation based on a TreeMap.
Vector class implements a growable array of
objects.
Implementing this interface allows an object to be the target of the enhanced
for statement (sometimes called the "for-each loop" statement).
Public methods | |
|---|---|
default
void
|
forEach(Consumer<? super T> action)
Performs the given action for each element of the |
abstract
Iterator<T>
|
iterator()
Returns an iterator over elements of type |
default
Spliterator<T>
|
spliterator()
Creates a |
public void forEach (Consumer<? super T> action)
Performs the given action for each element of the Iterable
until all elements have been processed or the action throws an
exception. Actions are performed in the order of iteration, if that
order is specified. Exceptions thrown by the action are relayed to the
caller.
The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.
The default implementation behaves as if:
for (T t : this)
action.accept(t);
| Parameters | |
|---|---|
action |
Consumer: The action to be performed for each element |
| Throws | |
|---|---|
NullPointerException |
if the specified action is null |
public abstract Iterator<T> iterator ()
Returns an iterator over elements of type T.
| Returns | |
|---|---|
Iterator<T> |
an Iterator. |
public Spliterator<T> spliterator ()
Creates a Spliterator over the elements described by this
Iterable.
Iterator. The spliterator
inherits the fail-fast properties of the iterable's iterator.| Returns | |
|---|---|
Spliterator<T> |
a Spliterator over the elements described by this
Iterable. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-02-13 UTC.