Returns a map from the ith element of list to i.
(Collection<E> list)
| 4132 | * Returns a map from the ith element of list to i. |
| 4133 | */ |
| 4134 | static <E> ImmutableMap<E, Integer> indexMap(Collection<E> list) { |
| 4135 | ImmutableMap.Builder<E, Integer> builder = new ImmutableMap.Builder<E, Integer>(list.size()); |
| 4136 | int i = 0; |
| 4137 | for (E e : list) { |
| 4138 | builder.put(e, i++); |
| 4139 | } |
| 4140 | return builder.build(); |
| 4141 | } |
| 4142 | |
| 4143 | /** |
| 4144 | * Returns a view of the portion of {@code map} whose keys are contained by {@code range}. |
no test coverage detected