/* * Copyright (c) 2019-present, Facebook, Inc. * * 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.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); } }