All Downloads are FREE. Search and download functionalities are using the official Maven repository.

xapi.collect.api.IntTo Maven / Gradle / Ivy

Go to download

This module exists solely to package all other gwt modules into a single uber jar. This makes deploying to non-mavenized targets much easier. Of course, you would be wise to inherit your dependencies individually; the uber jar is intended for projects like collide, which have complex configuration, and adding many jars would be a pain.

The newest version!
package xapi.collect.api;

import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import xapi.collect.proxy.CollectionProxy;


public interface IntTo 
extends CollectionProxy
{

  static interface Many  extends IntTo> {
    void add(int key, T item);
  }

  static class IntToIterable  implements Iterable  {
    private final IntTo self;
    public IntToIterable(IntTo self) {
      this.self = self;
    }
    @Override
    public Iterator iterator() {
      return new IntToIterator(self);
    }
  }
  static class IntToIterator  implements Iterator  {
    private IntTo source;
    int pos = 0;
    public IntToIterator(IntTo source) {
      this.source = source;
    }
    @Override
    public boolean hasNext() {
      return pos < source.size();
    }
    @Override
    public T next() {
      return source.at(pos++);
    }
    @Override
    public void remove() {
      if (source.remove(pos-1)) {
        pos--;
      }
    }
  }

  Iterable forEach();

  boolean add(T item);

  boolean addAll(Iterable items);

  @SuppressWarnings("unchecked")
  boolean addAll(T ... items);

  boolean insert(int pos, T item);

  boolean contains(T value);

  T at(int index);

  int indexOf(T value);

  boolean remove(int index);

  boolean findRemove(T value, boolean all);

  void set(int index, T value);

  void push(T value);

  T pop();

  /**
   * If this IntTo is mutable,
   * you will be getting a ListProxy, backed by this IntTo.
   * If the underlying IntTo forbids duplicates,
   * the ListProxy will act like a set.
   * 

* If this IntTo is immutable, * you are getting an ArrayList you can mutate as you wish. */ List asList(); /** * If this IntTo is mutable, * you will be getting a SetProxy, backed by this IntTo. * * This SetProxy will call remove(item) before every addInternal(item). * * If this IntTo is immutable, * you are getting a HashSet you can mutate as you wish. */ Set asSet(); /** * If this IntTo is mutable, * you will be getting a DequeProxy, backed by this IntTo. * * If the underlying IntTo forbids duplicates, * the DequeProxy will act like a set. * * If this IntTo is immutable, * you are getting a LinkedList you can mutate as you wish. */ Deque asDeque(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy