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