public synchronized void addItem(long weight, T item) {
        WeightBucket<T> bucket = new WeightBucket<T>(weight);
        int index = indexedSearch(buckets, bucket);
        if (index > buckets.size() - 1) {// 先加一个bucket
            bucket.addLastItem(item);
            buckets.add(index, bucket);
        } else if (buckets.get(index).getWeight() != weight) {// 不匹配的
            bucket.addLastItem(item);
            buckets.add(index, bucket);
        } else {
            buckets.get(index).addLastItem(item);// 添加到已有的bucket上
        }

    }
public synchronized void addItem ( long weight , T item ) { WeightBucket < T > bucket = new WeightBucket < T > ( weight ) ; int index = indexedSearch ( buckets , bucket ) ; if ( index > buckets . size ( ) - 1 ) { bucket . addLastItem ( item ) ; buckets . add ( index , bucket ) ; } else if ( buckets . get ( index ) . getWeight ( ) != weight ) { bucket . addLastItem ( item ) ; buckets . add ( index , bucket ) ; } else { buckets . get ( index ) . addLastItem ( item ) ; } }
添加一个节点