### Question:
ImmutableBitSet implements Iterable<Integer>, Serializable, Comparable<ImmutableBitSet> { public List<Integer> asList() { return new AbstractList<Integer>() { @Override public Integer get( int index ) { return nth( index ); } @Override public int size() { return cardinality(); } @Nonnull @Override public Iterator<Integer> iterator() { return ImmutableBitSet.this.iterator(); } }; } private  ImmutableBitSet( long[] words ); static ImmutableBitSet of(); static ImmutableBitSet of( int... bits ); static ImmutableBitSet of( Iterable<Integer> bits ); static ImmutableBitSet of( ImmutableIntList bits ); static ImmutableBitSet valueOf( long... longs ); static ImmutableBitSet valueOf( LongBuffer longs ); static ImmutableBitSet fromBitSet( BitSet input ); static ImmutableBitSet range( int fromIndex, int toIndex ); static ImmutableBitSet range( int toIndex ); Iterable<ImmutableBitSet> powerSet(); boolean get( int bitIndex ); ImmutableBitSet get( int fromIndex, int toIndex ); String toString(); boolean intersects( ImmutableBitSet set ); int cardinality(); int hashCode(); int size(); boolean equals( Object obj ); @Override int compareTo( @Nonnull ImmutableBitSet o ); int nextSetBit( int fromIndex ); int nextClearBit( int fromIndex ); int previousClearBit( int fromIndex ); @Override Iterator<Integer> iterator(); List<Integer> toList(); List<Integer> asList(); Set<Integer> asSet(); int[] toArray(); long[] toLongArray(); ImmutableBitSet union( BitSet other ); ImmutableBitSet union( ImmutableBitSet other ); static ImmutableBitSet union( Iterable<? extends ImmutableBitSet> sets ); ImmutableBitSet except( ImmutableBitSet that ); ImmutableBitSet intersect( ImmutableBitSet that ); boolean contains( ImmutableBitSet set1 ); int indexOf( int bit ); static SortedMap<Integer, ImmutableBitSet> closure( SortedMap<Integer, ImmutableBitSet> equivalence ); int length(); boolean isEmpty(); static Builder builder(); Builder rebuild(); int nth( int n ); ImmutableBitSet set( int i ); ImmutableBitSet set( int i, boolean b ); ImmutableBitSet setIf( int bit, boolean condition ); ImmutableBitSet clear( int i ); ImmutableBitSet clearIf( int i, boolean condition ); BitSet toBitSet(); ImmutableBitSet permute( Map<Integer, Integer> map ); static Iterable<ImmutableBitSet> permute( Iterable<ImmutableBitSet> bitSets, final Map<Integer, Integer> map ); ImmutableBitSet shift( int offset ); static final Comparator<ImmutableBitSet> COMPARATOR; static final Ordering<ImmutableBitSet> ORDERING; }### Answer:
@Test public void testAsList() { final List<ImmutableBitSet> list = getSortedList(); final Set<Integer> integers = new HashSet<>(); for ( ImmutableBitSet set : list ) { for ( Integer integer : set ) { integers.add( integer ); integers.add( integer + 1 ); integers.add( integer + 10 ); } } for ( ImmutableBitSet bitSet : list ) { final List<Integer> list1 = bitSet.toList(); final List<Integer> listView = bitSet.asList(); final Set<Integer> setView = bitSet.asSet(); assertThat( list1.size(), equalTo( bitSet.cardinality() ) ); assertThat( listView.size(), equalTo( bitSet.cardinality() ) ); assertThat( setView.size(), equalTo( bitSet.cardinality() ) ); assertThat( list1.toString(), equalTo( listView.toString() ) ); assertThat( list1.toString(), equalTo( setView.toString() ) ); assertEquals( list1, listView ); assertThat( list1.hashCode(), equalTo( listView.hashCode() ) ); final Set<Integer> set = new HashSet<>( list1 ); assertThat( setView.hashCode(), is( set.hashCode() ) ); assertThat( setView, equalTo( set ) ); for ( Integer integer : integers ) { final boolean b = list1.contains( integer ); assertThat( listView.contains( integer ), is( b ) ); assertThat( setView.contains( integer ), is( b ) ); } } }