Returns a map from the ith element of list to i.
(Collection<E> list)
| 4199 | |
| 4200 | |
| 4201 | static <E> ImmutableMap<E, Integer> indexMap(Collection<E> list) { |
| 4202 | ImmutableMap.Builder<E, Integer> builder = new ImmutableMap.Builder<E, Integer>(list.size()); |
| 4203 | int i = 0; |
| 4204 | for (E e : list) { |
| 4205 | builder.put(e, i++); |
| 4206 | } |
| 4207 | return builder.build(); |
| 4208 | } |
| 4209 | |
| 4210 | /** |
| 4211 | * Returns a view of the portion of {@code map} whose keys are contained by {@code range}. |
no test coverage detected