[Mulgara-svn] r1940 - trunk/src/jar/util/java/org/mulgara/util/functional
pag at mulgara.org
pag at mulgara.org
Thu Apr 22 03:45:37 UTC 2010
Author: pag
Date: 2010-04-21 20:45:36 -0700 (Wed, 21 Apr 2010)
New Revision: 1940
Modified:
trunk/src/jar/util/java/org/mulgara/util/functional/C.java
Log:
was using the name 'tail' when I should have said 'last'. 'tail' is a sublist of everything except 'first', and is an important (missing) function needed for good functional programming with lists.
Modified: trunk/src/jar/util/java/org/mulgara/util/functional/C.java
===================================================================
--- trunk/src/jar/util/java/org/mulgara/util/functional/C.java 2010-04-17 16:21:34 UTC (rev 1939)
+++ trunk/src/jar/util/java/org/mulgara/util/functional/C.java 2010-04-22 03:45:36 UTC (rev 1940)
@@ -149,7 +149,7 @@
* @return The last element in the list.
* @throws NoSuchElementException If the list is empty.
*/
- public static final <T1> T1 tail(LinkedList<T1> arg) throws NoSuchElementException {
+ public static final <T1> T1 last(LinkedList<T1> arg) throws NoSuchElementException {
return arg.getLast();
}
@@ -161,7 +161,7 @@
* @throws IndexOutOfBoundsException If the list is empty.
*/
@SuppressWarnings("unchecked")
- public static final <T1> T1 tail(List<T1> arg) throws NoSuchElementException {
+ public static final <T1> T1 last(List<T1> arg) throws NoSuchElementException {
if (arg instanceof LinkedList) return ((LinkedList<T1>)arg).getLast();
if (arg.size() == 0) throw new NoSuchElementException("Empty list");
return arg.get(arg.size() - 1);
@@ -173,7 +173,7 @@
* @param arg The list.
* @return The last element in the list, or <code>null</code> if the list is empty.
*/
- public static final <T1> T1 tailN(LinkedList<T1> arg) {
+ public static final <T1> T1 lastN(LinkedList<T1> arg) {
return arg.isEmpty() ? null : arg.getLast();
}
@@ -183,7 +183,7 @@
* @param arg The list.
* @return The last element in the list, or <code>null</code> if the list is empty.
*/
- public static final <T1> T1 tailN(List<T1> arg) {
+ public static final <T1> T1 lastN(List<T1> arg) {
return arg.isEmpty() ? null : arg.get(arg.size() - 1);
}
More information about the Mulgara-svn
mailing list