List in which package in java

Package java.util

Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes. This package also contains legacy collection classes and legacy date and time classes.

Java Collections Framework

Provides classes for reading and writing the JAR (Java ARchive) file format, which is based on the standard ZIP file format with an optional manifest file.

This package allows applications to store and retrieve user and system preference and configuration data.

This package contains classes and interfaces that support a generic API for random number generation.

Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.

This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.

This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a «random access» data store (such as an array).

This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.

This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a «sequential access» data store (such as a linked list).

This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.

This class consists exclusively of static methods for obtaining encoders and decoders for the Base64 encoding scheme.

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR , MONTH , DAY_OF_MONTH , HOUR , and so on, and for manipulating the calendar fields, such as getting the date of the next week.

This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.

The Dictionary class is the abstract parent of any class, such as Hashtable , which maps keys to values.

An abstract wrapper class for an EventListener class which associates a set of additional parameters with the listener.

The Formattable interface must be implemented by any class that needs to perform custom formatting using the ‘s’ conversion specifier of Formatter .

Читайте также:  Lvalue required error in cpp

FormattableFlags are passed to the Formattable.formatTo() method and modify the output format for Formattables.

GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.

HexFormat converts between bytes and chars and hex-encoded strings which may include additional formatting markup such as prefixes, suffixes, and delimiters.

This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).

Unchecked exception thrown when a character with an invalid Unicode code point as defined by Character.isValidCodePoint(int) is passed to the Formatter .

Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type.

Unchecked exception thrown when a format string contains an illegal syntax or a format specifier that is incompatible with the given arguments.

Unchecked exception thrown when the precision is a negative value other than -1 , the conversion does not support a precision, or the value is otherwise unsupported.

Unchecked exception thrown when the format width is a negative value other than -1 or is otherwise unsupported.

Thrown by methods in Locale and Locale.Builder to indicate that an argument is not a well-formed BCP 47 tag.

Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.

Thrown to indicate that an operation could not complete because the input did not conform to the appropriate XML document type for a collection of properties, as per the Properties specification.

An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator’s current position in the list.

ListResourceBundle is an abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.

Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist.

This class consists of static utility methods for operating on objects, or checking certain conditions before operation.

PropertyResourceBundle is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.

An instance of this class is used to generate a stream of pseudorandom numbers; its period is only 2 48 .

Marker interface used by List implementations to indicate that they support fast (generally constant time) random access.

ResourceBundle.Control defines a set of callback methods that are invoked by the ResourceBundle.getBundle factory methods during the bundle loading process.

Читайте также:  File access exceptions java

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.

Static classes and methods for operating on or creating instances of Spliterator and its primitive specializations Spliterator.OfInt , Spliterator.OfLong , and Spliterator.OfDouble .

A generator of uniform pseudorandom values (with period 2 64 ) applicable for use in (among other contexts) isolated parallel computations that may generate subtasks.

StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix.

The TooManyListenersException Exception is used as part of the Java Event model to annotate and implement a unicast special case of a multicast Event Source.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Interface List

An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

Unlike sets, lists typically allow duplicate elements. More formally, lists typically allow pairs of elements e1 and e2 such that e1.equals(e2) , and they typically allow multiple null elements if they allow null elements at all. It is not inconceivable that someone might wish to implement a list that prohibits duplicates, by throwing runtime exceptions when the user attempts to insert them, but we expect this usage to be rare.

The List interface places additional stipulations, beyond those specified in the Collection interface, on the contracts of the iterator , add , remove , equals , and hashCode methods. Declarations for other inherited methods are also included here for convenience.

The List interface provides four methods for positional (indexed) access to list elements. Lists (like Java arrays) are zero based. Note that these operations may execute in time proportional to the index value for some implementations (the LinkedList class, for example). Thus, iterating over the elements in a list is typically preferable to indexing through it if the caller does not know the implementation.

The List interface provides a special iterator, called a ListIterator , that allows element insertion and replacement, and bidirectional access in addition to the normal operations that the Iterator interface provides. A method is provided to obtain a list iterator that starts at a specified position in the list.

Читайте также:  Java native methods source

The List interface provides two methods to search for a specified object. From a performance standpoint, these methods should be used with caution. In many implementations they will perform costly linear searches.

The List interface provides two methods to efficiently insert and remove multiple elements at an arbitrary point in the list.

Note: While it is permissible for lists to contain themselves as elements, extreme caution is advised: the equals and hashCode methods are no longer well defined on such a list.

Some list implementations have restrictions on the elements that they may contain. For example, some implementations prohibit null elements, and some have restrictions on the types of their elements. Attempting to add an ineligible element throws an unchecked exception, typically NullPointerException or ClassCastException . Attempting to query the presence of an ineligible element may throw an exception, or it may simply return false; some implementations will exhibit the former behavior and some will exhibit the latter. More generally, attempting an operation on an ineligible element whose completion would not result in the insertion of an ineligible element into the list may throw an exception or it may succeed, at the option of the implementation. Such exceptions are marked as «optional» in the specification for this interface.

Unmodifiable Lists

  • They are unmodifiable. Elements cannot be added, removed, or replaced. Calling any mutator method on the List will always cause UnsupportedOperationException to be thrown. However, if the contained elements are themselves mutable, this may cause the List’s contents to appear to change.
  • They disallow null elements. Attempts to create them with null elements result in NullPointerException .
  • They are serializable if all elements are serializable.
  • The order of elements in the list is the same as the order of the provided arguments, or of the elements in the provided array.
  • The lists and their subList views implement the RandomAccess interface.
  • They are value-based. Programmers should treat instances that are equal as interchangeable and should not use them for synchronization, or unpredictable behavior may occur. For example, in a future release, synchronization may fail. Callers should make no assumptions about the identity of the returned instances. Factories are free to create new instances or reuse existing ones.
  • They are serialized as specified on the Serialized Form page.

This interface is a member of the Java Collections Framework.

Источник

Оцените статью