A simple solution for [] access that can trivially be added to List and Map.

Ulf Zibis Ulf.Zibis at gmx.de
Thu Jun 25 16:11:52 PDT 2009


Added my post to coin-dev at openjdk.java.net via CC: ...


I more would like:

public interface SetableByIndex<V> {
     public void set(int idx, V value);
}

public interface GetableByIndex<V> {
     public V get(int idx);
}

public interface PutableByKey<K, V> {
     public void put(K key, V value);
}

public interface GetableByKey<K, V> {
     public V get(K key);
}

.. or shorter:

public interface IndexSetable<V> {
     public void set(int idx, V value);
}

public interface IndexGetable<V> {
     public V get(int idx);
}

public interface KeyPutable<K, V> {
     public void put(K key, V value);
}

public interface KeyGetable<K, V> {
     public V get(K key);
}

-Ulf





More information about the coin-dev mailing list