Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Java collections
Java Collections can achieve all the operations that you perform on a data such as
searching, sorting, insertion, manipulation, and deletion.
Java Collection means a single unit of objects. Java Collection framework provides
many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList,
PriorityQueue, HashSet, LinkedHashSet, TreeSet).
Herencia (Figure 2)
o
o Polimorfismo: Se refiere a la posibilidad de definir clases diferentes que tienen
métodos o atributos denominados de forma idéntica pero se comportan diferente.
(Figure 3)
Polimorfismo (Fig
10 public boolean containsAll(Collection<?> c) It is used to search
the
Methods of
. They are:
2 public Object next() It returns the element and moves the cursor
pointer to the next element.
Iterable Interface
The Iterable interface is the root interface for all the collection classes. The
Collection interface extends the Iterable interface and therefore all the
subclasses of Collection interface also implement the Iterable interface.
Some of the methods of Collection interface are Boolean add ( Object obj),
Boolean addAll ( Collection c), void clear(), etc. which are implemented by all
the subclasses of Collection interface.
List Interface
Los tres pilares del desarrollo orientado a objetos son la encapsulación, la herencia y el
polimorfismo. Si... ya veo que en la imagen aparece también abstracción... no seas cansino.
La
Ejemplo Java
1;
return 0;
}
nombre = "";
apellidos = "";
edad = 0; }
this.nombre = nombre;
this.apellidos = apellidos;
this.edad = edad; }
En la subclase: public Profesor () {
super();
IdProfesor = "Unknown";}
Ligado Dinámico
Es importante entender qué método es aplicado al invocar uno a un
objeto que se puede referir a instancias de distinta clase.
Al momento de la compilación el compilador intenta resolver el método
que corresponde según su nombre y parámetro. Si la superclase y la clase
base tiene definido el mismo método ¿Cuál se llama?. Si el método en la
clase declarada para la variable no es privado, static, o final, se invocará en
forma dinámica. Esto es, se invocará el método definido según el objeto
referenciado por el nombre y no según la declaración del nombre. Por ello,
si una clase derivada redefine el mismo método, éste será invocado.
Casting