• Non ci sono risultati.

Java 2 Collections

N/A
N/A
Protected

Academic year: 2022

Condividi "Java 2 Collections"

Copied!
2
0
0

Testo completo

(1)

1

1

Java 2 Collections

Corso di Laurea in Informatica

Sperimentazioni di

Linguaggi di Programmazione: Paradigmi di Programmazione a.a. 1999/2000

Matteo Baldoni

2

SortedMap

SortedSet Collection

List Set

AbstractCollection

AbstractList

AbstractSet

AbstractSequentialList

LinkedList ArrayList

Vector Stack

TreeSet

Map AbstractMap

Hashtable TreeMap HashMap

Iterator

ListIterator

Comparable Comparator

Collections Array Utilities (Legacy)

(Legacy)

(Legacy)

Produces Produces

HashSet

JAVA 2 Collections

(2)

2

3 Boolean add(Object) *Ensures that the Collection contains the argument. Returns

false if it doesn’t add the argument.

Boolean addAll(Collection) *Adds all the elements in the argument. Returns true if any elements were added.

void clear( ) *Removes all the elements in the Collection.

Boolean contains(Object) True if the Collection contains the argument.

Boolean containsAll(Collection) True if the Collection contains all the elements in the argument.

Boolean isEmpty( ) True if the Collection has no elements.

Iterator iterator( ) Returns an Iterator that you can use to move through the elements in the Collection.

Boolean remove(Object) *If the argument is in the Collection, one instance of that element is removed. Returns true if a removal occurred.

Boolean removeAll(Collection) *Removes all the elements that are contained in the argument.

Returns true if any removals occurred.

Boolean retainAll(Collection) *Retains only elements that are contained in the argument (an

“intersection” from set theory). Returns true if any changes occurred.

int size( ) Returns the number of elements in the Collection.

Object[] toArray( ) Returns an array containing all the elements in the Collection.

Object[] toArray(Object[] a) Returns an array containing all the elements in the Collection, whose type is that of the array a rather than plain Object (you must cast the array to the right type).

*This is an “optional” method, which means it might not be implemented by a particular Collection. If not, that method throws an UnsupportedOperationException. Exceptions will be covered in Chapter 9.

Methods for JAVA 2 Collections

Riferimenti

Documenti correlati

A further indication of the possible involvement of SASP in the impairment of tissue regeneration in elderly, stems from a previous study of Baker et al. In this study it was

 The takeOrdered(num, key) action returns a local python list of objects containing the num smallest elements of the considered RDD sorted by. considering a user specified

FACT 8.4 The occ occurrences of a pattern P[1, p] in a text T [1, n] can be found in O(p + occ) time and O(n) space by using a suffix tree built on the input text T , in which

FACT 7.4 The occ occurrences of a pattern P[1, p] in a text T [1, n] can be found in O(p + occ) time and O(n) space by using a suffix tree built on the input text T and in which

Given that the suffix array is a sorted sequence of items, the most intuitive way to construct SA is to use an efficient comparison-based sorting algorithm.. In Section 7.4.1

Por otro lado, la dictadura mostró hasta el final su voluntad de ocultar las evidencias y también de añadir sufrimiento a las familias de los asesinados: justo cuando

El cambio de canal que plantea Labbé en el plano estructural –es decir, un texto híbrido que se compone de una suma de fragmentos textuales independientes y a su vez dotados, cada

While a general good agreement was observed between experimental data and model calculations for protons at all energies over the measured angular range, experi- mental data