APISonar


java.util.ArrayList.subList

> java > util > ArrayList > subList
java APIs util APIs ArrayList APIs subList APIs

Example 1
public void test_Constructor() {
        // Test for method java.util.ArrayList()
        new Support_ListTest("", alist).runTest();

        ArrayList subList = new ArrayList();
        for (int i = -50; i < 150; i++)
            subList.add(new Integer(i));
        new Support_ListTest("", subList.subList(50, 150)).runTest();
    }
Example 2
private ArrayList myArrayList;

	public List<Object> subList(int fromIndex, int toIndex) {
		// TODO Auto-generated method stub
		return myArrayList.subList(fromIndex,toIndex);
	}
Example 3
private transient ArrayList objects = new ArrayList();

	public void moveRow(int start, int end, int to) {
		List subList = objects.subList(start, end);
		for (int x = end - 1; x >= start; x--) {
			objects.remove(x);
		}
		objects.addAll(to, subList);
		super.fireTableChanged(new TableModelEvent(this));
	}
Example 4
private final ArrayList<E> executables;

	public void removeLastN(int n) {
		if ( n > 0 ) {
			int size = executables.size();
			for ( Executable e : executables.subList( size - n, size ) ) {
				if ( e.getPropertySpaces() != null && e.getPropertySpaces().length > 0 ) {
					// querySpaces could now be incorrect
					querySpaces = null;
					break;
				}
			}
			executables.subList( size - n, size ).clear();
		}
	}
Example 5
protected final ArrayList<Filter> filters;

  public String toString() {
    int endIndex = this.size() < MAX_LOG_FILTERS ? this.size() : MAX_LOG_FILTERS;
    return formatLogFilters(filters.subList(0, endIndex));
  }
Example 6
private static ArrayList<String> vals = new ArrayList<>();

  protected String anyValsSpaceDelim(int howMany) {
    Collections.shuffle(vals, random());
    return vals.subList(0, howMany).toString().replaceAll("[,\\[\\]]", "");
  }
Example 7
private static final ArrayList<ArrayList<byte[]>> garbage = new ArrayList<>();

    private void free() {
        // do not free last one list
        garbage.subList(0, garbage.size() - 1).clear();

        // do not free last one element from last list
        ArrayList stuff = garbage.get(garbage.size() - 1);
        stuff.subList(0, stuff.size() - 1).clear();
        System.gc();
    }
Example 8
private ArrayList<Fixture> list = new ArrayList<Fixture>();

    public List<Fixture> subList( final int i,
                                  final int i1 ) {
        return list.subList( i, i1 );
    }
Example 9
private final ArrayList<A> mHistoryList = new ArrayList<A>();

    public void truncateAfter(A item) {
        if (item == null)
            return;

        int idx = mHistoryList.indexOf(item);
        if (idx >= 0 && idx < mHistoryList.size() - 1) {
            mHistoryList.subList(idx + 1, mHistoryList.size()).clear();
            notifyHistoryChanged();
        }
    }// truncateAfter()
Example 10
private ArrayList<LogLine> mOriginalValues = new ArrayList<>();

    public void removeFirst(int n) {
        if (mOriginalValues != null) {
            List<LogLine> subList = mOriginalValues.subList(n, mOriginalValues.size());
            for (int i = 0; i < n; i++) {
                // value to delete - delete it from the mObjects as well
                mList.remove(mOriginalValues.get(i));
            }
            mOriginalValues = new ArrayList<>(subList);
        }
        notifyDataSetChanged();
    }
Example 11
private final ArrayList<V> valueList;

    public static void dropLocalScope(int localScopeStart, List<?> valueList) {
        if (localScopeStart >= 0 && valueList.size() - localScopeStart > 0) {
            valueList.subList(localScopeStart, valueList.size()).clear();
        }
    }
Example 12
List<String> seek(List<String> immList, String toFind) {
    ArrayList<String> list = new ArrayList<>(immList.size());
    list.addAll(immList);
    int i;
    for (i = 0; i < list.size(); i++) {
      if (list.get(i).equals(toFind)) {
        break;
      }
    }
    return list.subList(i, list.size());
  }
Example 13
private final ArrayList<byte[]> writeBuffers = new ArrayList<byte[]>(1);

  public void seal() {
    if (currentWriteOffset < (wbSize * 0.8)) { // arbitrary
      byte[] smallerBuffer = new byte[currentWriteOffset];
      System.arraycopy(currentWriteBuffer, 0, smallerBuffer, 0, currentWriteOffset);
      writeBuffers.set(currentWriteBufferIndex, smallerBuffer);
    }
    if (currentWriteBufferIndex + 1 < writeBuffers.size()) {
      writeBuffers.subList(currentWriteBufferIndex + 1, writeBuffers.size()).clear();
    }
    currentWriteBuffer = currentReadBuffer = null; // Make sure we don't reference any old buffer.
    currentWriteBufferIndex = currentReadBufferIndex = -1;
    currentReadOffset = currentWriteOffset = -1;
  }
Example 14
private final ArrayList<byte[]> writeBuffers = new ArrayList<byte[]>(1);

  public void seal() {
    if (writePos.bufferIndex == -1) {
      return;
    }
    if (writePos.offset < (wbSize * 0.8)) { // arbitrary
      byte[] smallerBuffer = new byte[writePos.offset];
      System.arraycopy(writePos.buffer, 0, smallerBuffer, 0, writePos.offset);
      writeBuffers.set(writePos.bufferIndex, smallerBuffer);
    }
    if (writePos.bufferIndex + 1 < writeBuffers.size()) {
      writeBuffers.subList(writePos.bufferIndex + 1, writeBuffers.size()).clear();
    }
    // Make sure we don't reference any old buffer.
    clearState();
  }
Example 15
public ArrayList<Integer> path = new ArrayList<>();

	public List<Integer> subPath(int start, int end){
		try {
			end = Math.min( end, path.size()-1);
			return path.subList(start, end+1);
		} catch (Exception e){
			ShatteredPixelDungeon.reportException(e);
			return new ArrayList<>();
		}
	}
Example 16
static MethodHandle changeArgTypes(MethodHandle target,
            int beg, int end, Class<?> argType) {
        MethodType targetType = target.type();
        end = Math.min(end, targetType.parameterCount());
        ArrayList<Class<?>> argTypes = new ArrayList<>(targetType.parameterList());
        Collections.fill(argTypes.subList(beg, end), argType);
        MethodType ttype2 = MethodType.methodType(targetType.returnType(), argTypes);
        return target.asType(ttype2);
    }
Example 17
private ArrayList<Value> location;

    public String toString() {
        final int maxLen = 3;
        StringBuilder builder = new StringBuilder();
        builder.append("PointBuilder [dimensions=")
                .append(dimensions != null ? dimensions.subList(0, Math.min(dimensions.size(), maxLen)) : null)
                .append(", location=").append(location != null ? location.subList(0, Math.min(location.size(), maxLen)) : null)
                .append("]");
        return builder.toString();
    }
Example 18
public List<User> getUsers(int max) {
		ArrayList<User> users = getUsers();
		return users.subList(0, Math.min(max, users.size()));
	}
Example 19
public List<MethodStats> getTop(int limit)
  {
    ArrayList<MethodStats> statList = new ArrayList<MethodStats>(data_.values());
    Collections.sort(statList);
    return statList.subList(0, Math.min(limit, statList.size()));
  }
Example 20
private static void duplicatePath(int lastPathIndex, State fromState,
            State toState, ArrayList<ArrayList<State>> paths) {
        ArrayList<State> lastPath = paths.get(lastPathIndex);
        // copy the last path to a new one, from start to current state
        int fromIndex = lastPath.indexOf(fromState);
        int toIndex = lastPath.indexOf(toState);
        if (toIndex == -1) {
            toIndex = lastPath.size() - 1;
        }
        ArrayList<State> newPath = new ArrayList<State>(lastPath.subList(
                fromIndex, toIndex));
        paths.add(newPath);
    }
Example 21
private ArrayList<Song> mSongs = new ArrayList<Song>(12);

	public void clearQueue()
	{
		synchronized (this) {
			saveActiveSongs();
			if (mCurrentPos + 1 < mSongs.size())
				mSongs.subList(mCurrentPos + 1, mSongs.size()).clear();
			broadcastChangedSongs();
		}

		changed();
	}
Example 22
private void verifySomePass(ArrayList<String> paths) {
    assertEquals(paths.subList(0, 2), Arrays.asList(ServerConstants.checkBaseUris(conf, hadoopConf,
        paths.toArray(new String[paths.size()]), true)));
    try {
      ServerConstants.checkBaseUris(conf, hadoopConf, paths.toArray(new String[paths.size()]),
          false);
      fail();
    } catch (Exception e) {
      // ignored
    }
  }
Example 23
ArrayList<Pipe> pipes;

	public SerialPipes newSerialPipesFromSuffix (Predicate testForStartingNewPipes) {
		int i = 0;
		while (i < pipes.size())
			if (testForStartingNewPipes.predicate(pipes.get(i))) {
				return new SerialPipes(pipes.subList(i, pipes.size()-1));
			}
		throw new IllegalArgumentException ("No pipes in this SerialPipe satisfied starting predicate.");
	}
Example 24
private ArrayList<OneWireTypeModifier> ivTypeModifieryList = new ArrayList<OneWireTypeModifier>();

    public String toString() {
        final int maxLen = 20;
        return "AbstractOneWireDevicePropertyBindingConfig [deviceId=" + ivDeviceId + ", propertyName=" + ivPropertyName
                + ", autoRefreshInSecs=" + ivAutoRefreshInSecs + ", typeModifieryList=" + (ivTypeModifieryList != null
                        ? ivTypeModifieryList.subList(0, Math.min(ivTypeModifieryList.size(), maxLen)) : null)
                + "]";
    }
Example 25
private static final ArrayList<ArchiveMigrationStep> ALL_MIGRATION_STEPS = new ArrayList<>();

    public static List<ArchiveMigrationStep> createPlan(final int version)
    {
        final List<ArchiveMigrationStep> steps = new ArrayList<>();

        for (int i = 0, size = ALL_MIGRATION_STEPS.size(); i < size; i++)
        {
            if (ALL_MIGRATION_STEPS.get(i).minimumVersion() > version)
            {
                steps.addAll(ALL_MIGRATION_STEPS.subList(i, size));
                break;
            }
        }

        return steps;
    }