Sort a Set or a List accordingly to the specified parameters. <p> <b>examples:</b> <p> Given are the following sets and key/values:
<pre> x = [1, 2, 3] y = [a, b, c]
k1 = z k2 = y k3 = x
w1 = 9 w2 = 8 w3 = 7 </pre>
Sort Order:
<pre> sort(x) or sort(x, sp.asc()) -> [1, 2, 3]
sort(x, sp.desc()) -> [3, 2, 1]
sort(y) -> [c, a, b]
sort(y, sp.alpha()) -> [a, b, c]
sort(y, sp.alpha().desc()) -> [c, a, b] </pre>
Limit (e.g. for Pagination):
<pre> sort(x, sp.limit(0, 2)) -> [1, 2]
sort(y, sp.alpha().desc().limit(1, 2)) -> [b, a] </pre>
Sorting by external keys:
<pre> sort(x, sb.by(w*)) -> [3, 2, 1]
sort(x, sb.by(w*).desc()) -> [1, 2, 3] </pre>
Getting external keys:
<pre> sort(x, sp.by(w*).get(k*)) -> [x, y, z]
sort(x, sp.by(w*).get(#).get(k*)) -> [3, x, 2, y, 1, z] </pre> @see #sort(string) @see #sort(string, SortingParams, string) @param key @param sortingParameters @return a list of sorted elements.
See Implementation
Sort a Set or a List accordingly to the specified parameters. <p> <b>examples:</b> <p> Given are the following sets and key/values:
<pre> x = [1, 2, 3] y = [a, b, c]
k1 = z k2 = y k3 = x
w1 = 9 w2 = 8 w3 = 7 </pre>
Sort Order:
<pre> sort(x) or sort(x, sp.asc()) -> [1, 2, 3]
sort(x, sp.desc()) -> [3, 2, 1]
sort(y) -> [c, a, b]
sort(y, sp.alpha()) -> [a, b, c]
sort(y, sp.alpha().desc()) -> [c, a, b] </pre>
Limit (e.g. for Pagination):
<pre> sort(x, sp.limit(0, 2)) -> [1, 2]
sort(y, sp.alpha().desc().limit(1, 2)) -> [b, a] </pre>
Sorting by external keys:
<pre> sort(x, sb.by(w*)) -> [3, 2, 1]
sort(x, sb.by(w*).desc()) -> [1, 2, 3] </pre>
Getting external keys:
<pre> sort(x, sp.by(w*).get(k*)) -> [x, y, z]
sort(x, sp.by(w*).get(#).get(k*)) -> [3, x, 2, y, 1, z] </pre> @see #sort(string) @see #sort(string, SortingParams, string) @param key @param sortingParameters @return a list of sorted elements.