@SuppressWarnings("unchecked")
	public synchronized List<T> removeAllNoOrder() {
		if (end == -1) {
			List<Object> a = Arrays.asList(array);
			array = new Object[array.length];
			start = end = 0;
			return (List<T>)a;
		}
		if (start == end) return Collections.EMPTY_LIST;
		if (end > start) {
			Object[] a = new Object[end - start];
			System.arraycopy(array, start, a, 0, end - start);
			for (int i = start; i < end; ++i) array[i] = null;
			start = end = 0;
			return (List<T>)Arrays.asList(a);
		}
		Object[] a = new Object[array.length - start + end];
		System.arraycopy(array, start, a, 0, array.length - start);
		if (end > 0)
			System.arraycopy(array, 0, a, array.length - start, end);
		for (int i = array.length - 1; i >= 0; --i) array[i] = null;
		start = end = 0;
		return (List<T>)Arrays.asList(a);
	}
@ SuppressWarnings ( "unchecked" ) public synchronized List < T > removeAllNoOrder ( ) { if ( end == - 1 ) { List < Object > a = Arrays . asList ( array ) ; array = new Object [ array . length ] ; start = end = 0 ; return ( List < T > ) a ; } if ( start == end ) return Collections . EMPTY_LIST ; if ( end > start ) { Object [ ] a = new Object [ end - start ] ; System . arraycopy ( array , start , a , 0 , end - start ) ; for ( int i = start ; i < end ; ++ i ) array [ i ] = null ; start = end = 0 ; return ( List < T > ) Arrays . asList ( a ) ; } Object [ ] a = new Object [ array . length - start + end ] ; System . arraycopy ( array , start , a , 0 , array . length - start ) ; if ( end > 0 ) System . arraycopy ( array , 0 , a , array . length - start , end ) ; for ( int i = array . length - 1 ; i >= 0 ; -- i ) array [ i ] = null ; start = end = 0 ; return ( List < T > ) Arrays . asList ( a ) ; }
Remove all elements and return them, but the returned list is not ordered.
The reason it is not ordered is for performance, when the order is not important.