Esempio n. 1
0
 /**
  * Returns a list which is a concatenation of <code>times</code> times the receiver.
  *
  * @param times the number of times the receiver shall be copied.
  */
 public AbstractLongList times(int times) {
   AbstractLongList newList = new LongArrayList(times * size());
   for (int i = times; --i >= 0; ) {
     newList.addAllOfFromTo(this, 0, size() - 1);
   }
   return newList;
 }
Esempio n. 2
0
 /**
  * Sets the receiver's elements to be the specified array. The size and capacity of the list is
  * the length of the array. <b>WARNING:</b> For efficiency reasons and to keep memory usage low,
  * this method may decide <b>not to copy the array</b>. So if subsequently you modify the returned
  * array directly via the [] operator, be sure you know what you're doing.
  *
  * @param elements the new elements to be stored.
  * @return the receiver itself.
  */
 public AbstractLongList elements(long[] elements) {
   clear();
   addAllOfFromTo(new LongArrayList(elements), 0, elements.length - 1);
   return this;
 }