OSDN Git Service

46bc7735608b1acbd66463b709c39c4c3b55aa72
[android-x86/packages-apps-Eleven.git] / src / com / cyanogenmod / eleven / utils / Lists.java
1 /*
2  * Copyright 2012 Google Inc. Licensed under the Apache License, Version 2.0
3  * (the "License"); you may not use this file except in compliance with the
4  * License. You may obtain a copy of the License at
5  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
6  * or agreed to in writing, software distributed under the License is
7  * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8  * KIND, either express or implied. See the License for the specific language
9  * governing permissions and limitations under the License.
10  */
11
12 package com.cyanogenmod.eleven.utils;
13
14 import java.util.ArrayList;
15 import java.util.Collections;
16 import java.util.LinkedList;
17
18 /**
19  * Provides static methods for creating {@code List} instances easily, and other
20  * utility methods for working with lists.
21  */
22 public final class Lists {
23
24     /** This class is never instantiated */
25     public Lists() {
26     }
27
28     /**
29      * Creates an empty {@code ArrayList} instance.
30      * <p>
31      * <b>Note:</b> if you only need an <i>immutable</i> empty List, use
32      * {@link Collections#emptyList} instead.
33      *
34      * @return a newly-created, initially-empty {@code ArrayList}
35      */
36     public static final <E> ArrayList<E> newArrayList() {
37         return new ArrayList<E>();
38     }
39
40     /**
41      * Creates an empty {@code LinkedList} instance.
42      * <p>
43      * <b>Note:</b> if you only need an <i>immutable</i> empty List, use
44      * {@link Collections#emptyList} instead.
45      *
46      * @return a newly-created, initially-empty {@code LinkedList}
47      */
48     public static final <E> LinkedList<E> newLinkedList() {
49         return new LinkedList<E>();
50     }
51
52 }