/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; class CollectionsTest { int binary_search_log(List list) { return Collections.binarySearch(list, "x"); } void shuffle_linear(List list, Random mRandom) { Collections.shuffle(list, mRandom); for (int i = 0; i < list.size(); i++) {} } void singletonSet_constant() { Set set = Collections.singleton("ezgi"); for (String s : set) {} } void singletonList_constant(String el) { List list = Collections.singletonList(el); for (String s : list) {} } void fill_linear(List list, String el) { Collections.fill(list, el); } void reverse_linear(List list) { Collections.reverse(list); } void reverse_constant(String el) { List list = Collections.singletonList(el); Collections.reverse(list); } void copy_linear(List list_from, List list_to) { Collections.copy(list_to, list_from); } void unmodifiable_linear(List list) { List unmod_list = Collections.unmodifiableList(list); for (int i = 0; i < unmod_list.size(); i++) {} } void unmodifiable_map(Map map) { for (Map.Entry entry : Collections.unmodifiableMap(map).entrySet()) {} } void unmodifiable_set(Set set) { for (Integer el : Collections.unmodifiableSet(set)) {} } void emptySet_zero() { Set set = Collections.emptySet(); for (String s : set) {} } void emptyList_constant() { for (int i = 0; i < Collections.emptyList().size(); i++) {} } void singletonMap_constant() { for (int i = 0; i < Collections.singletonMap(1, 1).size(); i++) {} } }