int put(T segment,List<? super T> recycleBin){
  int count;
  if (lastCount == 0) {
    count=0;
    lastCount=1;
    last=segment;
  }
 else   if (Objects.deepEquals(last,segment)) {
    ++lastCount;
    count=0;
    recycleBin.add(segment);
  }
 else {
    count=lastCount;
    lastCount=1;
    last=segment;
  }
  return count;
}

int put ( T segment , List < ? super T > recycleBin ) { int count ; if ( lastCount == 0 ) { count = 0 ; lastCount = 1 ; last = segment ; } else if ( Objects . deepEquals ( last , segment ) ) { ++ lastCount ; count = 0 ; recycleBin . add ( segment ) ; } else { count = lastCount ; lastCount = 1 ; last = segment ; } return count ; }
adds an element to the stream . if that element is the same as the last element this buffer saw , it won ' t be added to the stream , but will instead be recycled . if this element is different than the one before , this class will return the number of times that other element had been seen . the caller is responsible for having retrieved that element before calling this method .
