cern.colt.list.AbstractCollection Maven / Gradle / Ivy
Show all versions of parallelcolt Show documentation
/*
Copyright (C) 1999 CERN - European Organization for Nuclear Research.
Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose
is hereby granted without fee, provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear in supporting documentation.
CERN makes no representations about the suitability of this software for any purpose.
It is provided "as is" without expressed or implied warranty.
*/
package cern.colt.list;
/**
* Abstract base class for resizable collections holding objects or primitive
* data types such as int
, float
, etc. First see the
* package summary and javadoc tree view to get the broad picture.
*
* Note that this implementation is not synchronized.
*
* @author [email protected]
* @version 1.0, 09/24/99
* @see java.util.ArrayList
* @see java.util.Vector
* @see java.util.Arrays
*/
// public abstract class AbstractCollection extends Object implements Cloneable,
// java.io.Serializable {
public abstract class AbstractCollection extends cern.colt.PersistentObject {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Makes this class non instantiable, but still let's others inherit from
* it.
*/
protected AbstractCollection() {
}
/**
* Removes all elements from the receiver. The receiver will be empty after
* this call returns.
*/
public abstract void clear();
/**
* Tests if the receiver has no elements.
*
* @return true
if the receiver has no elements;
* false
otherwise.
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Returns the number of elements contained in the receiver.
*
* @return the number of elements contained in the receiver.
*/
public abstract int size();
/**
* Returns a java.util.ArrayList
containing all the elements in
* the receiver.
*/
public abstract java.util.ArrayList toList();
/**
* Returns a string representation of the receiver, containing the String
* representation of each element.
*/
public String toString() {
return toList().toString();
}
}