1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.google.common.collect;
18
19 import com.google.common.annotations.GwtCompatible;
20 import com.google.common.annotations.GwtIncompatible;
21
22
23
24
25
26
27
28 @GwtCompatible(emulated = true)
29 @SuppressWarnings("serial")
30 class RegularImmutableAsList<E> extends ImmutableAsList<E> {
31 private final ImmutableCollection<E> delegate;
32 private final ImmutableList<? extends E> delegateList;
33
34 RegularImmutableAsList(ImmutableCollection<E> delegate, ImmutableList<? extends E> delegateList) {
35 this.delegate = delegate;
36 this.delegateList = delegateList;
37 }
38
39 RegularImmutableAsList(ImmutableCollection<E> delegate, Object[] array) {
40 this(delegate, ImmutableList.<E>asImmutableList(array));
41 }
42
43 @Override
44 ImmutableCollection<E> delegateCollection() {
45 return delegate;
46 }
47
48 ImmutableList<? extends E> delegateList() {
49 return delegateList;
50 }
51
52 @SuppressWarnings("unchecked")
53 @Override
54 public UnmodifiableListIterator<E> listIterator(int index) {
55 return (UnmodifiableListIterator<E>) delegateList.listIterator(index);
56 }
57
58 @GwtIncompatible("not present in emulated superclass")
59 @Override
60 int copyIntoArray(Object[] dst, int offset) {
61 return delegateList.copyIntoArray(dst, offset);
62 }
63
64 @Override
65 public E get(int index) {
66 return delegateList.get(index);
67 }
68 }