ch.javasoft.jbase.util
Class Tables

java.lang.Object
  extended by ch.javasoft.jbase.util.Tables

public class Tables
extends Object

The Tables class contains static helper methods to deal with tables. It is comparable to the Collections or Arrays class.


Field Summary
static Table<?> EMPTY_TABLE
           
 
Method Summary
static
<E> void
addAll(Iterable<? extends E> src, Table<E> dst)
           
static
<E> void
addAll(Table<? extends E> src, Table<E> dst)
           
static Object[] asArray(Table<?> table)
           
static
<A,E extends A>
A[]
asArray(Table<E> table, A[] array)
           
static
<E> List<E>
asList(Table<E> table)
           
static
<E> Table<E>
autoflushTable(Table<E> table)
           
static
<E> Table<E>
emptyTable()
          Returns an empty (immutable) table
static
<E> Enumeration<E>
enumeration(Table<E> table)
           
static
<E> void
fill(Table<E> table, E value)
           
static
<E> Table<E>
synchronizedTable(Table<E> table)
          Returns an synchronized, thread-safe table (All methods of the table are synchronized).
static
<E> Table<E>
unmodifyableTable(Table<E> table)
          Returns an unmodifyable table, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_TABLE

public static final Table<?> EMPTY_TABLE
Method Detail

emptyTable

public static <E> Table<E> emptyTable()
Returns an empty (immutable) table


unmodifyableTable

public static <E> Table<E> unmodifyableTable(Table<E> table)
Returns an unmodifyable table, i.e. all write operations of the returned table throw an UnsupportedOperationException


synchronizedTable

public static <E> Table<E> synchronizedTable(Table<E> table)
Returns an synchronized, thread-safe table (All methods of the table are synchronized).

Note: consider using an instance of ConcurrentTable instead, which is oftentimes more efficient.


autoflushTable

public static <E> Table<E> autoflushTable(Table<E> table)

asList

public static <E> List<E> asList(Table<E> table)

asArray

public static Object[] asArray(Table<?> table)

asArray

public static <A,E extends A> A[] asArray(Table<E> table,
                                          A[] array)

enumeration

public static <E> Enumeration<E> enumeration(Table<E> table)

fill

public static <E> void fill(Table<E> table,
                            E value)
                 throws IOException
Throws:
IOException

addAll

public static <E> void addAll(Iterable<? extends E> src,
                              Table<E> dst)
                   throws IOException
Throws:
IOException

addAll

public static <E> void addAll(Table<? extends E> src,
                              Table<E> dst)
                   throws IOException
Throws:
IOException