Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: base/android/java/src/org/chromium/base/CollectionUtil.java

Issue 601983002: Revert of Revert of Set the javac target and source to 1.7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/android/gyp/javac.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.Collections; 8 import java.util.Collections;
9 import java.util.HashSet; 9 import java.util.HashSet;
10 10
11 /** 11 /**
12 * Functions used for easier initialization of Java collections. Inspired by 12 * Functions used for easier initialization of Java collections. Inspired by
13 * functionality in com.google.common.collect in Guava but cherry-picked to 13 * functionality in com.google.common.collect in Guava but cherry-picked to
14 * bare-minimum functionality to avoid bloat. (http://crbug.com/272790 provides 14 * bare-minimum functionality to avoid bloat. (http://crbug.com/272790 provides
15 * further details) 15 * further details)
16 */ 16 */
17 public final class CollectionUtil { 17 public final class CollectionUtil {
18 private CollectionUtil() {} 18 private CollectionUtil() {}
19 19
20 @SafeVarargs
20 public static <E> HashSet<E> newHashSet(E... elements) { 21 public static <E> HashSet<E> newHashSet(E... elements) {
21 HashSet<E> set = new HashSet<E>(elements.length); 22 HashSet<E> set = new HashSet<E>(elements.length);
22 Collections.addAll(set, elements); 23 Collections.addAll(set, elements);
23 return set; 24 return set;
24 } 25 }
25 26
27 @SafeVarargs
26 public static <E> ArrayList<E> newArrayList(E... elements) { 28 public static <E> ArrayList<E> newArrayList(E... elements) {
27 ArrayList<E> list = new ArrayList<E>(elements.length); 29 ArrayList<E> list = new ArrayList<E>(elements.length);
28 Collections.addAll(list, elements); 30 Collections.addAll(list, elements);
29 return list; 31 return list;
30 } 32 }
31 33
32 public static <E> ArrayList<E> newArrayList(Iterable<E> iterable) { 34 public static <E> ArrayList<E> newArrayList(Iterable<E> iterable) {
33 ArrayList<E> list = new ArrayList<E>(); 35 ArrayList<E> list = new ArrayList<E>();
34 for (E element : iterable) { 36 for (E element : iterable) {
35 list.add(element); 37 list.add(element);
36 } 38 }
37 return list; 39 return list;
38 } 40 }
39 } 41 }
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/javac.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698