Evaluation

Status
Nicht offen für weitere Antworten.

El Jay

Mitglied
Hi,

Ich hab mich gefragt wie groß der Aufwand ist um ein eigenes Collection-Framework zu basteln. Ich hab selbst alle Interfaces und Implementierungen konzipiert und geschrieben (Ähnlichkeit mit denen der Java API sind nicht zu vermeiden). Das einzige was ich aus der API verwende, ist die Klasse "Object" (wer hätte es gedacht) und noch in dieser Version "NoSuchElementException".

Mir ist klar, dass 645 Zeilen Code eine menge Holz ist, ihr müsst ja nicht alles genau, Zeile für Zeile, durch gehen. Ich verlange auch nicht dass ihr hier anfangt das Ding zu debuggen. Nur mal überfliegen und ne Meinung abgeben, was gut, was schlecht ist.

Es gibt noch Schwachstelle im Bezug auf Multithreading und man kann die Interator For-Schleife nicht nutzen da mein Interface "Enumeration" nicht von der Java Klasse "Interator" abgeleitet ist, aber ansonsten bin ich mit meiner Umsetzung sehr zufrieden. Ich setzt bei meinen Projekten nun immer erfolgreich mein eigenes Collections-Framework ein.

Natürlich, um eine genauere Aussage zu treffen wäre es gut ein komplettes UML Diagramm meines Frameworks zu posten.

Dennoch meine Fragen:

1. Ist mir der Versuch gelungen (im Bezug auf diese Klasse).
2. Sieht das was ich da fabriziert habe halbwegs wie professioneller Code aus.

[HIGHLIGHT="Java"]package jay_ware.home.girls;

import java.util.NoSuchElementException;

import jay_ware.home.boys.Collection;
import jay_ware.home.boys.Enumeration;
import jay_ware.home.boys.List;

import jay_ware.hustelers.Revision;

/**
* A default implementation of the interface <code>List<code>.
*
* @param <E> the type of elements maintained by this XList.
*
* @author El Jay
* @version 1.0 19.04.2008
* @version 1.1 05.05.2008
*
*/
public class XList<E>
implements List<E>
{
/**
* The elements stored in this list.
*/
protected Object[] elements;

/**
* The maximum number of elements in this list.
*/
protected int size;

/**
* The first size of this list.
*/
protected final int INITIAL_SIZE;

/**
* The amount of elements in this list.
*/
protected int count;

/**
* Constructs an empty list with a default capacity of 8.
*/
@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public XList()
{
this(8);
}

/**
* Constructs a list containing the elements of the specified collection.
*
* @param c the collection which hold the elements to add.
*
*/
@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public XList(Collection<E> c)
{
this(c.count());
this.addAll(c);
}

/**
* Constructs a list with the specified capacity.
*
* @param capacity the capacity for the new list.
*
*/
@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public XList(int capacity)
{
this.INITIAL_SIZE = capacity;
this.clear();
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public boolean add(E e)
{
//Check whether the specified element is a null reference.
if (e == null)
{
//Throw a NullPointerException, because
//the specified element is null.
throw new NullPointerException
("Specified element is null");
}

//Check whether in the array is
//enough space for a new element.
if (count < size)
{
//Delegate the specified element and the
//index of a free position to the method 'set()'
return set(e, indexOf(null));
}

else
{
//There is not enough space for a new element,
//so resize the array to get more.
resize(size + INITIAL_SIZE);
//Now is enough space, so delegate the specified element
//and the index of a free position to the method 'set()'
return set(e, indexOf(null));
}
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public boolean addAll(Collection<? extends E> c)
{
//Check first the specified collection whether it is null.
if (c == null)
{
throw new NullPointerException
("The specified collection is null");
}
//Now check the necessary space in the array to
//add all elements of the specified collection.
if ((size - count) < c.count())
{
//Get the amount of necessary space.
int necessary = c.count() + count;
//Resize this list, because there is not enough space
//for all elements of the specified collection. The new
//size is the calculated "necessary" size plus the initial
//size to get more space like a buffer.
resize(necessary + INITIAL_SIZE);
}
//
//Now it is ready to start the process of adding.
//
//The final result of this operation.
boolean result = true;
//Maybe a empty position in the array.
int empty = 0;
//The number of elements which was already added.
int added = 0;
//An Enumeration over the elements of the specified collection.
Enumeration<? extends E> e = c.elements();

//Repeat it until the last element is added.
do
{
//Check whether the position in the array is empty.
if (elements[empty] == null)
{
//The position is empty, add a element.
//Delegates the index of the empty position and the
//next element in the enumeration to the method set();
boolean successful = set(e.next(), empty);

//Check whether the process was successful.
if (!successful)
{
//The final result is false if one of the
//elements couldn't added to this list.
result = false;
}
//Increment the index of the next empty position.
empty++;
//Increment the variable which count
//the number of added elements.
added++;
}
//If the position is not empty find the next one.
else
{
empty = indexOf(null);
}
//Check whether all elements are added to the array.
} while (added < c.count());

//Return the final result of this operation.
return result;
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
protected void checkIndex(int index)
{
//Check whether the specified index is a legal index.

//Check whether the specified index is greater than Integer.MAX_VALUE.
if (index > Integer.MAX_VALUE)
{
throw new ArrayIndexOutOfBoundsException
("The specified index is greater than Integer.MAX_VALUE" +
" -> index = " + index + "!!");
}
//Check whether the specified index is less than 0.
if (index < 0)
{
throw new ArrayIndexOutOfBoundsException
("The specified index is less than 0 -> index = " + index + "!!");
}
}

@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public void clear()
{
//Resizes the array to the first given size,
//all old elements were deleted and the list is clear.
this.elements = new Object[this.INITIAL_SIZE];

//Restore to defaults
this.size = this.INITIAL_SIZE;
this.count = 0;
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public boolean contains(Object obj)
{
//Check whether the specified object is not null.
if (obj != null)
{
//Use the method indexOf() to find out whether
//this list contain the specified object.
return indexOf(obj) >= 0;
}
//The specified object is null, so it can't be present in this list.
return false;
}

@Revision(author = "El Jay", version = "1.0", date = "05.05.2008")
public boolean containsAll(Collection<?> c)
{
//Check whether the specified collection is null.
if (c == null)
{
throw new NullPointerException
("Specified collection can't be null");
}
//Check whether this collection or the specified one is empty, if so
//return false, because the test is not necessary.
if (this.isEmpty() || c.isEmpty())
{
return false;
}
//Get a enumeration over the specified collection.
Enumeration<?> e = c.elements();
//The final result of this operation.
boolean result = false;
//Walk through the enumeration.
do
{
//Check whether the enumeration has more elements.
if (e.hasNext())
{
//Check whether this collection contain
//the next element in the enumeration.
result = contains(e.next());
}

//Repeat this until the enumeration has no more elements.
else break;

//Only one false if necessary to say that this list doesn't contain
//all elements of the specified collection.
} while (result);

//Return the final result of this operation.
return result;
}

@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public int count()
{
return this.count;
}

@Revision(author = "El Jay", version = "1.0", date = "28.04.2008")
public Enumeration<E> elements()
{
return new Enumeration<E>()
{
//The courser of this enumeration.
int courser = 0;

public boolean hasNext()
{
//Returns true if the courser is less than the array's size.
return courser < size;
}

public E next()
{
if (isEmpty())
{
throw new NoSuchElementException
("The list dosen't contain any element!!");
}
//Hold an element at the current courser position.
E element = null;
//Check that the enumeration don't reach the end of the array.
if (hasNext())
{
//May repeat the following lines to skip a null reference.
//Repeat this until the element is not null.
while (element == null && hasNext())
{
//Get the element at the courser position and
//increment the courser of this enumeration.
element = (E) elements[courser++];

}
//Return the element at the current courser position.
return element;
}
//Return the last element.
return element;
}
};
}

@Revision(author = "El Jay", version = "1.0", date = "28.04.2008")
public E get(int index)
{
//Delegate the specified index to the method checkIndex()
//to check whether the specified index is a legal index.
checkIndex(index);

//Returns the element at the specified index.
return (E) elements[index];
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public int indexOf(Object obj)
{
//Walk through the array.
for (int i = 0; i < size; i++)
{
//Check whether the specified object is null, that
//indicates the operation looks for an empty position.
if (obj == null)
{
//Check whether the element at the index i is null.
if (elements == null)
{
//The element at the index i
//is null, so return the index.
return i;
}
}
//The specified object isn't null so the operation look
//for a occurrence of the specified object in this list
else
{
//Prevent an exception, so check that the
//element at the index i is not null.
if (elements != null)
{
//Compare the element at the index i
//with the specified object.
if (elements.equals(obj))
{
//The comparison was successful, so return the index.
return i;
}
}
}
}
//The operation failed, it didn't find a occurrence of specified
//object in this list or there is no empty position in this list.
return -1;
}

@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public boolean isEmpty()
{
return this.count == 0;
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public boolean remove(int index)
{
//Delegate the specified index to the method checkIndex()
//to check whether the specified index is a legal index.
checkIndex(index);

//Remove the element at the specified index.
elements[index] = null;

//Decrement the element count.
count--;

return true;
}

@Revision(author = "El Jay", version = "1.0", date = "27.04.2008")
public boolean remove(Object obj)
{
//Find the index of the specified object in this list.
int index = indexOf(obj);

//Check whether is greater than 0, so the
//specified object is present in this list.
if (index > 0)
{
//Delegate the specified index to the method remove(index) to
//remove the specified object by using the index of it.
return remove(index);
}

return false;
}

@Revision(author = "El Jay", version = "1.0", date = "06.05.2008")
public boolean removeAll(Collection<? extends E> c)
{
//Check whether the specified collection is null.
if (c == null)
{
throw new NullPointerException
("Specified collection can't be null");
}
//Check whether this collection or the specified one is empty, if so
//return false, because the operation is not necessary.
if (this.isEmpty() || c.isEmpty())
{
return false;
}
//With this variable can test whether this list could changed.
int test = this.count;
//The index of the element.
int index = -1;
//Get a enumeration over the specified collection.
Enumeration<?> e = c.elements();
//Walk through the enumeration.
while (e.hasNext())
{
//get the index of the next element
//in the enumeration in this list.
index = indexOf(e.next());
//Check whether the specified index isn't less
//than 0, so the element is present in this list.
if (index >= 0)
{
elements[index] = null;
count--;
}
}
//Return true if the test variable is greater than the current list's
//count, so the operation could remove some elements.
return test > count;
}

@Revision(author = "El Jay", version = "1.0", date = "28.04.2008")
protected void resize(int size)
{
// //
//It is important to know, is the specified size greater or //
//less than current size. If the specified size is less than the//
//current size some elements would be deleted, because they may //
//be out of new bounds after resizing, but the smallest size is //
//the number of elements in the current array. //
// //
if (size < this.size)
{
//The smallest size that a list can get is the number of elements.
//An array to hold the data of the current array.
Object[] old = new Object[this.count];
//To get the elements without the empty positions in the array the
//operation use a enumeration over the elements of this list.
Enumeration<E> en = this.elements();
//Walk throw the enumeration.
for (int i = 0; i < this.count; i++)
{
old = en.next();
}
//All elements were now copied in the array,
//now resize the list's array.
elements = new Object[this.count];
//Copy the elements back in the list's array.
System.arraycopy(old, 0, elements, 0, this.count);
}
//The size is greater so resize the array to the new size.
else
{
//An array as a backup of the current array's data.
Object[] old = new Object[this.size];
//Copy the data in the new array.
System.arraycopy(elements, 0, old, 0, this.size);
//...resizing...
elements = new Object[size];
//After copy the elements of the backup back in the list's array.
System.arraycopy(old, 0, elements, 0, this.size);
}

//Set the list's size to the new size.
this.size = size;
}

@Revision(author = "El Jay", version = "1.0", date = "06.05.2008")
public boolean retainAll(Collection<? extends E> c)
{
//Check whether the specified collection is null.
if (c == null)
{
throw new NullPointerException
("Specified collection can't be null");
}
//Check whether the specified collection is empty.
if (c.isEmpty())
{
return false;
}
//Walk through the array of this list.
for (int i = 0; i < size; i++)
{
//Get the element at the index i.
Object obj = elements;
//Check whether the specified object isn't null
if (obj != null)
{
//Check whether the specified collection
//doesn't contain the object.
if (!c.contains(obj))
{
elements = null;
count--;
}
}
}
//Always true.
return true;
}

@Revision(author = "El Jay", version = "1.0", date = "28.04.2008")
public boolean set(E e, int index)
{
//Check the specified element first.
if (e == null)
{
throw new NullPointerException
("The specified element is null");
}
//Check the specified index.
if (index < 0)
{
throw new ArrayIndexOutOfBoundsException
("The specified index is less than 0 -> index = " + index);
}
//The specified index is greater 0.
else
{
//Check that the specified index is in the array's bounds,
//so the specified index is less than the array's size.
if (index < size)
{
//...
}
//The specified index is out of bounds.
else
{
//Resize the array to a size that the specified index is
//in the array's bounds, to more formally the index is the
//last index in the array.
resize(index + 1);
}
}
//The current element at the specified index.
E current = (E) elements[index];
//When all parameters are tested add the
//specified element to this list.
elements[index] = e;
//Increment the element counter if at the specified index
//is no element to replace and the specified one is a new.
if (current == null)
{
count++;
}

return true;
}

@Revision(author = "El Jay", version = "1.0", date = "06.05.2008")
public boolean setAll(Collection<? extends E> c, int index)
{
//Check whether the specified collection is null.
if (c == null)
{
throw new NullPointerException
("Specified collection can't be null");
}
//Check whether the specified collection is empty.
if (c.isEmpty())
{
return false;
}
//
//Check the index.
//
if (index > (size - c.count() - 1))
{
resize(size + index + c.count());
}
//Get an enumeration over the elements of the specified collection.
Enumeration<? extends E> e = c.elements();
//Walk through the enumeration until
//the enumeration doesn't has more.
while (e.hasNext())
{
//To add an element of the collection, delegate one
//element at time to the method set() with the index
//which increment after every adding.
set(e.next(), index++);
}
//Always true.
return true;
}

@Revision(author = "El Jay", version = "1.0", date = "19.04.2008")
public int size()
{
return this.size;
}

@Revision(author = "El Jay", version = "1.0", date = "05.05.2008")
public List<E> subList(int start, int end)
{
//Check the parameters first.
//Whether the start index is greater than the end index.
if (start >= end)
{
throw new IllegalArgumentException
("start index is greater than the end index!!");
}
//Whether the start index is out of bounds.
checkIndex(start);
//Whether the end index is out of bounds.
checkIndex(end);
//Get the capacity of the sublist.
int capacity = end - start + 1;
//Instantiate a new list object.
XList<E> l = new XList<E>(capacity);
//Copy the elements into the new list.
System.arraycopy(elements, start, l.elements, 0, capacity);
//Set the element count of the sub list.
l.count = capacity;
//Return the sub list.
return l;
}
}[/HIGHLIGHT]

Wenn ihr euch fragt was das für komische Packages sind (Z.1, Z.5-7, Z.9), das ist creative Namensgebung:D



El Jay
 

0x7F800000

Top Contributor
Es gibt noch Schwachstelle im Bezug auf Multithreading und man kann die Interator For-Schleife nicht nutzen da mein Interface "Enumeration" nicht von der Java Klasse "Interator" abgeleitet ist, aber ansonsten bin ich mit meiner Umsetzung sehr zufrieden. Ich setzt bei meinen Projekten nun immer erfolgreich mein eigenes Collections-Framework ein.
Nun ja, zum Üben ist das alles sehr schön und gut, aber ich hoffe doch, dass du nicht ernsthaft vorhast, das bei irgendeinem halbwegs realitätsnahen Projekt einzusetzen? :eek:
 
S

SlaterB

Gast
ich bin nur bis zur ersten Methode gekommen:
was hast du gegen add(null)? bei den Java-Collections ist das erlaubt, bei dir aus einem bestimmten Grund nicht?

wenn es so bleibt, dann wirf aber nicht NullPointerException, die hat doch eine bestimmte Bedeutung und zwar eine andere (Fehlzugriff),
NullPointerException sollte man nie selber werfen,
sondern in diesem Fall z.B. die IllegalArgumentException

beim Einfügen verwendest du dann indexOf(null), ist das nicht immer genau der aktuelle Wert von count?

da die Methode indexOf(Object) public ist, könnte so auch ein Fremder indexOf(null) aufrufen und bekommt dann den gleichen Wert wie bei size() zurück,
leicht merkwürdig in meinen Augen ;)

ach halt, size() liefert nicht count zurück, sondern size,
das ist aber nun stark anders als die normale Collections, das möchtest du bestimmt nicht,
die interne Array-Größe geht nach außen niemanden etwas an
 

Marco13

Top Contributor
Ooohh-Kaay... *tu es nicht*...
Ich habe nur mal *tu es nicht*
kurz drübergeschaut und *tu es nicht*
dabei sin... *tu es ..

Ach, scheiß' drauf - ich tu es DOCH: Ich stelle die Frage: Wozu das ganze?
Zum Üben? OK.
Für irgendeinen anderen Zweck? Nicht gut.

Aber zum eigentlichen Code - die Kommentare sind GROB nach "Wichtigkeit" sortiert:

1. "courser"... OK, ich hätte es jetzt "cursor" genannt, aber "courser" passt ja auch :D


2.Das hier
Code:
if (index < size)
{
    //...
}
else
ist schlechter Stil: Das sollte
if (index>=size) ...
heißen.


3. Ganz lustig fand ich
Code:
if (index > Integer.MAX_VALUE)
{
     throw new ArrayIndexOutOfBoundsException
         ("The specified index is greater than Integer.MAX_VALUE" +
                   " -> index = " + index + "!!");
}
Wenn du es schaffst, dass dort diese Exception geworfen wird, musst du mir verraten, wie du das gemacht hast.


4. Wenn man in diese List n Elemente einfügen will, hat das quadratische Laufzeit O(n*n). Wenn es notwendig ist, die Liste zu vergrößern, sollte sie nicht um einen konstanten Wert, sondern um einen konstanten Faktor (>1) vergrößert werden, dann braucht das Einfügen von n Elementen nur lineare Laufzeit O(n)


5. Kritischer fand ich, dass "subList" offenbar nicht den Vertrag einhält, der für die Methode zugesichert wird: List (Java Platform SE 6), int)


6. equals und hashCode sind nicht überschrieben!
 
S

Spacerat

Gast
@Wildcard: Stutzig macht einen das doch wohl nur, angesichts des geposteten Codes.
Ich selbst hielte es z.B. schon für eine gute idee, bei der "add()"-Methode ungewollte Elemente (z.B. null oder doppelt) zu eliminieren. Allerdings... obiger Code ist ja wohl schon deswegen recht überflüssig, weil es dafür schon ein extrem flexibles API (eben Collections) gibt, wleches nur noch erweitert und/oder an die eigenen Wünsche angepasst werden muss.
 
Zuletzt bearbeitet von einem Moderator:

0x7F800000

Top Contributor
habe ich jetzt nicht verstanden. null wird man ja wohl an irgendeiner anderen Stelle prüfen müssen, was kann denn die Datenstruktur dafür? Falls man keine doppelten Einträge haben will, dann nehme man irgendein Set...
 
S

Spacerat

Gast
@Andrey: dito... irgend ein Set wird dabei auch schon von Haus aus den Zugriff über den Index bieten. Nee mal Scherz beiseite. Wenn man sich die beiden Interfaces Set und List mal genauer ansieht, könnte List doch genau so gut Set, statt Collections erweitern. Das einzige was, wenn man mal vom Inhalt absieht, die beiden Interfaces unterscheidet, ist doch der gewünschte Zugriff über den Index. Wieso sollte es also verwerflich sein, auf diese Art und Weise eine List zu einem Set zu machen?
 

tfa

Top Contributor
Ich find's völlig über-kommentiert, davon unterdokumentiert. Für fast jede Zeile Quelltext zwei Zeilen Kommentare ist Quatsch. Schreib lieber mehr Dokumentation mit Javadoc.
 
M

maki

Gast
Eieieiei.... was soll man da noch sagen, wurde doch schon alles gesagt... vielleicht noch ein "RTFM vs. Re-Invent the wheel"

Ansonsten:
1. Ist mir der Versuch gelungen (im Bezug auf diese Klasse).
2. Sieht das was ich da fabriziert habe halbwegs wie professioneller Code aus.
1. Nein.
2. Nein.

Die Begründungen haben meine Vorredner schon genannt.
 

0x7F800000

Top Contributor
@Andrey: dito... irgend ein Set wird dabei auch schon von Haus aus den Zugriff über den Index bieten. Nee mal Scherz beiseite. Wenn man sich die beiden Interfaces Set und List mal genauer ansieht, könnte List doch genau so gut Set, statt Collections erweitern. Das einzige was, wenn man mal vom Inhalt absieht, die beiden Interfaces unterscheidet, ist doch der gewünschte Zugriff über den Index. Wieso sollte es also verwerflich sein, auf diese Art und Weise eine List zu einem Set zu machen?
Ja und? Wenn man so ein Ding braucht, dann nimmt man trotzdem die normale API, sieht sich die üblichen Interfaces genau an, und baut sich eine datenstruktur, die sowohl List als auch Set implementiert, wenn man unbedingt will. Da gibt's jetzt keinen Grund eine eigene Collections-Api neuzuerfinden.
 

Marco13

Top Contributor
Mal ganz allgemein: Es spricht natürlich erstmal nichts dagegen, eigene Implementierungen für die Interfaces der Collection-API zu erstellen - genau DAfür sind Interfaces ja da. Aber abgesehen davon, dass es (außer zu Übungszwecken) nicht viel Sinn macht, eine Implementierung von "List" zu erstellen, wenn man stattdessen ArrayList verwenden kann, sollte JEDE Implementierung des List-Interfaces sich an die Vorgaben aus dem List-Interface halten - und das tut diese Implementierung nicht, was der einzige "echte" Kritikpunkt ist....
 

0x7F800000

Top Contributor
sollte JEDE Implementierung des List-Interfaces sich an die Vorgaben aus dem List-Interface halten - und das tut diese Implementierung nicht, was der einzige "echte" Kritikpunkt ist....
Gilt nicht. Die el_jay.homeboys.List hat ja nichts mit der java.util.List zu tun, also muss sie sich auch an nichts halten. Es ist nicht diese konkrete Implementierung, es ist einfach insgesammt eine recht bekloppte idee.
 

El Jay

Mitglied
Danke für eure Beiträge. Genau so etwas wollte ich hören.

Allerdings nicht so ob es Sinn macht oder nicht, es ist ganz klar Quatsch das Rad immer neu zu erfinden. Nur ich habe z.B. früher oft die Klasse java.util.Vector verwendet und mich immer gefragt wie so etwas funktioniert. Jeder weis, dass man das in der Dokumentation nachlesen oder sich den Quelltext anschauen kann. Jeder weis auch das Alkohol in mengen nicht gut ist und dennoch probiert man es selbst aus.

Mir hat eure Teilnahme gefallen, wenn ihr noch mehr Kritik habt immer her damit.

Mir ist so etwas wichtig, denn wie soll ich besser werden wenn nie jemand sagt wo ich Fehler mache.

Vielen Danke, Gruß

el jay
 

0x7F800000

Top Contributor
Wie gesagt: zum Üben ist das super, aber verwende es bitte nicht^^
Schreibe lieber ein paar komplexere Datenstrukturen streng nach API-vorschriften. Das ist zum einen nützlicher, zum anderen spannender & schwieriger, als irgendwas halb-durchdachtes aus dem Leeren Raum zu erfinden.
 
S

Spacerat

Gast
Ja und? Wenn man so ein Ding braucht, dann nimmt man trotzdem die normale API, sieht sich die üblichen Interfaces genau an, und baut sich eine datenstruktur, die sowohl List als auch Set implementiert, wenn man unbedingt will. Da gibt's jetzt keinen Grund eine eigene Collections-Api neuzuerfinden.
Klar, da sind wir uns einig. Worum es mir ging: die Methoden des Interfaces Set befinden sich durchweg auch in List und List hat dann noch einige mehr. Ich selbst mache mir deswegen gar nicht mehr die Mühe bei einer derartigen Implementation Set auch noch zu implementieren, nur um irgendwelchen Konventionen des Collection APIs zu entsprechen. Was solls... bevor es wieder ausartet... Schwamm drüber...
 
Status
Nicht offen für weitere Antworten.

Ähnliche Java Themen

Neue Themen


Oben