aboutsummaryrefslogtreecommitdiff
path: root/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'src/ch')
-rw-r--r--src/ch/epfl/xblast/Lists.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/ch/epfl/xblast/Lists.java b/src/ch/epfl/xblast/Lists.java
index da3f919..cc6a1c8 100644
--- a/src/ch/epfl/xblast/Lists.java
+++ b/src/ch/epfl/xblast/Lists.java
@@ -66,6 +66,20 @@ public final class Lists {
66 } 66 }
67 67
68 /** 68 /**
69 * Returns an immutable copy of the given list, sorted using the supplied comparator.
70 *
71 * @param l the list to sort
72 * @param cmp the Comparator to use
73 * @param <T> the type of the list's elements
74 * @return the sorted list
75 */
76 public static <T> List<T> sorted(List<T> l, Comparator<T> cmp) {
77 List<T> r = new ArrayList<>(l);
78 Collections.sort(r, cmp);
79 return Collections.unmodifiableList(r);
80 }
81
82 /**
69 * Returns a copy of the given list surrounded with element e. 83 * Returns a copy of the given list surrounded with element e.
70 * 84 *
71 * @param l the list 85 * @param l the list
@@ -167,18 +181,4 @@ public final class Lists {
167 .collect(Collectors.toList())); 181 .collect(Collectors.toList()));
168 } 182 }
169 183
170 /**
171 * Returns an immutable copy of the given list, sorted using the supplied comparator.
172 *
173 * @param l the list to sort
174 * @param cmp the Comparator to use
175 * @param <T> the type of the list's elements
176 * @return the sorted list
177 */
178 public static <T> List<T> sorted(List<T> l, Comparator<T> cmp) {
179 List<T> r = new ArrayList<>(l);
180 Collections.sort(r, cmp);
181 return Collections.unmodifiableList(r);
182 }
183
184} 184}