rules.smartMode(); todoFiles = new JoddArrayList<>(); todoFolders = new JoddArrayList<>(); pathList = new JoddArrayList<>(); return; pathListOriginal = (JoddArrayList<File>) pathList.clone(); String[] files = new String[pathList.size()]; Iterator<File> iterator = pathList.iterator(); while (iterator.hasNext()) { File file = iterator.next(); todoFiles.add(filesIterator);
public void add(int index, E element) { if (index == 0) { addFirst(element); return; add(element); return; rangeCheck(index); ensureCapacity(index, 1); // increments modCount!!
/** * Removes from this list all of its elements that are contained in the * specified collection. */ @Override public boolean removeAll(Collection<?> c) { return batchRemove(c, false); }
/** * Inserts all array elements to this list. */ public boolean addAll(int index, E... array) { rangeCheck(index); return doAddAll(index, array); }
/** * Removes the element at the specified position in this list. * Shifts any subsequent elements. */ @Override @SuppressWarnings("unchecked") public E remove(int index) { rangeCheck(index); modCount++; return doRemove(index); }
/** * Adds existing search path to the file list. * Non existing files are ignored. * If path is a folder, it will be scanned for all files. */ protected void addPath(File path) { if (!path.exists()) { return; } if (pathList == null) { pathList = new JoddArrayList<>(); } pathList.add(path); }
if (!todoFiles.isEmpty()) { FilesIterator filesIterator = todoFiles.getLast(); File nextFile = filesIterator.next(); todoFiles.removeLast(); continue; todoFolders.add(nextFile); continue; todoFiles.add(new FilesIterator(nextFile)); boolean initialDir = false; if (todoFolders.isEmpty()) { if (pathList.isEmpty()) { folder = pathList.removeFirst(); folder = todoFolders.removeFirst(); todoFiles.add(new FilesIterator(folder));
/** * Walks over the child notes, maintaining the tree order and not using recursion. */ protected void walkDescendantsIteratively(JoddArrayList<Node> nodes, CssSelector cssSelector, List<Node> result) { while (!nodes.isEmpty()) { Node node = nodes.removeFirst(); selectAndAdd(node, cssSelector, result); // append children in walking order to be processed right after this node int childCount = node.getChildNodesCount(); for (int i = childCount - 1; i >= 0; i--) { nodes.addFirst(node.getChild(i)); } } }
/** * Appends the specified element to the end of this list. */ @Override public boolean add(E e) { int index = size; ensureCapacity(index, 1); // increments modCount!! buffer[end] = e; end++; size++; return true; }
/** * Constructs an empty list with the specified initial capacity. */ public JoddArrayList(int initialCapacity) { init(initialCapacity); }
/** * Appends all elements of given array. */ public boolean addAll(E... array) { if (array.length == 0) { return false; } return doAddAll(array); }
/** * Returns the last element of the list. */ public E getLast() { return get(size - 1); }
/** * Returns <code>true</code> if this list contains the specified element. */ @Override public boolean contains(Object o) { return indexOf(o) >= 0; }
/** * Appends element to the list. */ public boolean addLast(E e) { return add(e); }
/** * Removes the first occurrence of the specified element from this list, * if it is present. */ @Override public boolean remove(Object o) { if (o == null) { for (int index = start; index < end; index++) { if (buffer[index] == null) { doRemove(index - start); return true; } } } else { for (int index = start; index < end; index++) { if (o.equals(buffer[index])) { doRemove(index - start); return true; } } } return false; }
/** * Inserts all of the elements in the specified collection into this * list, starting at the specified position. Shifts the element * currently at that position (if any) and any subsequent elements. * The new elements will appear in the list in the order that they are returned by the * specified collection's iterator. */ @Override public boolean addAll(int index, Collection<? extends E> collection) { rangeCheck(index); Object[] array = collection.toArray(); return doAddAll(index, array); }
/** * Removes the element at the specified position in this list. * Shifts any subsequent elements. */ @Override @SuppressWarnings("unchecked") public E remove(int index) { rangeCheck(index); modCount++; return doRemove(index); }
/** * Adds the specified element to the beginning of this list. */ public boolean addFirst(E e) { int index = 0; ensureCapacity(index, 1); // increments modCount!! if (size > 0) { start--; } else { end++; } buffer[start] = e; size++; return true; }
JoddArrayList<Node> nodes = new JoddArrayList<>(); int childCount = rootNode.getChildNodesCount(); for (int i = 0; i < childCount; i++) { nodes.add(rootNode.getChild(i));
/** * Constructs an empty list with an initial capacity of ten. */ public JoddArrayList() { init(DEFAULT_CAPACITY); }