public synchronized void add(K obj){
  int len=array.length;
  array=Arrays.copyOf(array,len + 1);
  array[len]=obj;
}

public synchronized void add ( K obj ) { int len = array . length ; array = Arrays . copyOf ( array , len + 1 ) ; array [ len ] = obj ; }
add an element at the end .
