Java method list (memorial) (under construction)

java method list

◆java.util.*; ** ・ Collections.unmodifiableXXX ([List and Map instances]); **

//If it is only final, it cannot be reassigned, but elements can be added / deleted.
//Unmodifiable XXX disables element modification.
//If you try to change it, an "UnsupportedOperationException" will be thrown.

//List (Do not add a semicolon at the end of the instance initializer line)
private static final List<String> LIST_1 = Collections.unmodifiableList( new ArrayList<String>() {{ add("X"); add("Y"); }} );

private static final Map<Integer, String> MAP_1 = Collections.unmodifiableMap( new HashMap<Integer, String>() {{ put(1, "X"); put(2, "Y"); }} );

◇ Main methods of Collection interface

Method name Description
boolean add(E e) Add the argument element to the collection. Returns true if the collection has changed as a result of this call
void add(int index, E element) Adds an element at the specified position. If there are elements at that position and after that, move them and add 1 to the index of each element.
void clear() Remove all elements from this collection
boolean contains(Object obj) Returns true if the specified element obj exists in this collection
boolean containsAll(Collection<?> c) Returns true if all elements of the specified collection are contained in this collection
boolean isEmpty() Returns true if this collection contains no elements
boolean remove(Object o) Deletes the element specified in the argument and returns true if the element is deleted
boolean removeAll(Collection<?> c) Removes all elements from the collection specified in the method argument from this collection and returns true if the contents of this collection have changed as a result of calling this method.
Iterator iterator() Returns an iterator for the elements of this collection
Object[] toArray() Returns an array containing all the elements of this collection
T[] toArray(T[] array) Returns an array containing all the elements of this collection. T returns the data type of the array element
int size() Returns the number of elements in the collection
Method name Description
Method name Description

Recommended Posts

Java method list (memorial) (under construction)
Java method
java (method)
List method
Java method
[Java] method
[Java] method
Java runtime environment construction method (Tomcat @ Linux)
[Java] Environment construction
Java memorandum (list)
Clone Java List.
Java8 method reference
Java environment construction
[Java] forEach method
java8 method reference
[Java] Random method
[Java] split method
About List [Java]
Wastefully creative "Hello World" output method list (Java)
[java] sort in list
JAVA DB connection method
Java learning 2 (learning calculation method)
Java learning memo (method)
About Java method binding
[Java ~ Method ~] Study memo (5)
About method splitting (Java)
Studying Java 8 (see method)
[In-house study session] Basics of Java annotation (2017/11/02) ~ Under construction ~
About Java Array List
Switching java version (memorial)
Java programming (class method)
java development environment construction
[Java] Basic method notes
[Memo] Java Linked List
Easy way to check method / field list in Java REPL
[Java] List type / Array type conversion
[Java] New Thread generation method (2)
Java GC method determination conditions
Java Silver Study Method Memo
Create a java method [Memo] [java11]
Java test code method collection
[Java Silver] About equals method
JavaFX environment construction in Java 13
[Java] Timer processing implementation method
AtCoder Challenge Environment Construction (Java 8)
[Java] Random number generation method (Random)
[Java] List OS-dependent standard libraries
Java methods and method overloads
List aggregation in Java (Collectors.groupingBy)
Benefits of Java static method
[Java Silver] Array generation method
Java List Group, Sort, etc.
List data structure [Java / Scala]
[Java] New Thread generation method (1)
[Java] List method that determines whether a specific object is included