public Object create() { TLinkedList list = new TLinkedList(); for (int i = 0; i < 1000; i++) { TLinkableAdaptor a = new TLinkableAdaptor(); list.add(a); } return list; } }
/** * Insert <tt>linkable</tt> at the current position of the iterator. * Calling next() after add() will return the added object. * * @param linkable an object of type TLinkable */ public final void add(Object linkable) { _lastReturned = null; _nextIndex++; if (_size == 0) { TLinkedList.this.add(linkable); } else { TLinkedList.this.addBefore(_next, (TLinkable)linkable); } }
.size() + 1 : 1; ArrayList<EntityId> entities = new ArrayList<>(numFinalizers); ArrayList<HostConnection> sources = new ArrayList<>(numFinalizers); if (batchedFinalizers != null) { for (int i = 0; i < (numFinalizers - 1); i++) { addBulkCloseArgs((ClientFinalizer)batchedFinalizers.get(i), entities, sources, services, closeServices); closeServices, 100L)) { if (batchedFinalizers != null) { batchedFinalizers.clear();
public void ours() { List l = new TLinkedList(); for (Iterator i = data.iterator(); i.hasNext();) { l.add(i.next()); } }
/** * Inserts newElement into the list immediately before current. * All elements to the right of and including current are shifted * over. * * @param current a <code>TLinkable</code> value currently in the list. * @param newElement a <code>TLinkable</code> value to be added to * the list. */ public void addBefore(TLinkable current, TLinkable newElement) { if (current == _head) { addFirst(newElement); } else if (current == null) { addLast(newElement); } else { TLinkable p = current.getPrevious(); newElement.setNext(current); p.setNext(newElement); newElement.setPrevious(p); current.setPrevious(newElement); _size++; } }
/** * Appends <tt>linkable</tt> to the end of the list. * * @param linkable an object of type TLinkable * @return always true */ @Override // GemStoneAddition public boolean add(Object linkable) { insert(_size, linkable); return true; }
/** * Inserts <tt>linkable</tt> at the head of the list. * * @param linkable an object of type TLinkable */ public void addFirst(Object linkable) { insert(0, linkable); }
/** * {@inheritDoc} */ @Override public BatchFinalize merge(BatchFinalize o) { if (o instanceof ClientFinalizer) { ClientFinalizer other = (ClientFinalizer)o; final HostConnection hostConn = other.source; final HostConnection thisConn = this.source; // to maximise batch, group by target HostAddress i.e. for each distinct // GFXDServiceImpl, which means a connection/ClientService may send // bulkClose request for a different connection/ClientService on the same // server which is by design if (hostConn != null && thisConn != null && hostConn.hostAddr.equals(thisConn.hostAddr)) { if (this.batchedFinalizers == null) { this.batchedFinalizers = new TLinkedList(); } this.batchedFinalizers.add(other); return this; } } return null; } }
/** * Inserts <tt>linkable</tt> at index <tt>index</tt> in the list. * All values > index are shifted over one position to accomodate * the new addition. * * @param index an <code>int</code> value * @param linkable an object of type TLinkable */ @Override // GemStoneAddition public void add(int index, Object linkable) { if (index < 0 || index > size()) { throw new IndexOutOfBoundsException("index:" + index); } insert(index,linkable); }
/** * {@inheritDoc} */ @Override public BatchFinalize merge(BatchFinalize o) { if (o instanceof ClientFinalizer) { ClientFinalizer other = (ClientFinalizer)o; final HostConnection hostConn = other.source; final HostConnection thisConn = this.source; // to maximise batch, group by target HostAddress i.e. for each distinct // SnappyDataServiceImpl, which means a connection/ClientService may send // bulkClose request for a different connection/ClientService on the same // server which is by design if (hostConn != null && thisConn != null && hostConn.hostAddr.equals(thisConn.hostAddr)) { if (this.batchedFinalizers == null) { this.batchedFinalizers = new TLinkedList(); } this.batchedFinalizers.add(other); return this; } } return null; } }