summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/utilities/datastructures/arraylike/ListArrayAdapter.java
blob: 792fad0b48199ed52ebf58b4736ec0fd6c2e6f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package de.lmu.ifi.dbs.elki.utilities.datastructures.arraylike;

import java.util.List;

/**
 * Static adapter class to use a {@link java.util.List} in an array API.
 * 
 * Use the static instance from {@link ArrayLikeUtil}!
 * 
 * @author Erich Schubert
 * 
 * @param <T> Data object type.
 */
public class ListArrayAdapter<T> implements ArrayAdapter<T, List<? extends T>> {
  /**
   * Constructor.
   *
   * Use the static instance from {@link ArrayLikeUtil}!
   */
  protected ListArrayAdapter() {
    super();
  }

  @Override
  public int size(List<? extends T> array) {
    return array.size();
  }

  @Override
  public T get(List<? extends T> array, int off) throws IndexOutOfBoundsException {
    return array.get(off);
  }
}