English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java possède de nombreux méthodes ArrayList, qui nous permettent d'utiliser ArrayList. Sur cette page de référence, vous trouverez toutes les méthodes disponibles dans Java pour ArrayList, des exemples d'utilisation des méthodes ArrayList, etc. Par exemple, si vous souhaitez ajouter un élément à l'arraylist, utilisez la méthode add().
Méthode | Description |
---|---|
add() | Insère un élément dans l'arraylist |
addAll() | Ajoute tous les éléments du set à l'arraylist |
clear() | Supprime tous les éléments de l'arraylist |
clone() | Copie l'arraylist |
contains() | Vérifie si l'élément existe dans l'arraylist |
get() | Retourne l'élément existant à l'index spécifié |
indexOf() | Retourne la position de l'élément spécifié |
removeAll() | Supprime plusieurs éléments de l'arraylist |
remove() | Supprime un élément unique de l'arraylist |
size() | Retourne le nombre d'éléments de l'arraylist |
isEmpty() | Vérifiez si l'arraylist est vide |
subList() | Retourne une partie de l'arraylist |
set() | Replace a single element in the ArrayList |
sort() | Sort the ArrayList according to the specified order |
toArray() | Convert the ArrayList to an array |
toString() | Convert the ArrayList to a String |
ensureCapacity() | Adjust the capacity size of the ArrayList |
lastIndexOf() | Return the last occurrence position of the element |
retainAll() | Return the retained common elements |
containsAll() | Check if the collection is a subset of the ArrayList |
trimToSize() | Modify the capacity of the ArrayList example to the current size of the list |
removeRange() | Delete a part of the ArrayList |
replaceAll() | Replace all elements in the ArrayList |
removeIf() | Delete elements that meet certain conditions |
forEach() | Traverse all elements of the ArrayList |
iterator() | Return an iterator for traversing the ArrayList in a loop |