From ebf96a30d0122d35e271bad15f1f31a0a9100842 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Sun, 24 Oct 2010 20:47:53 +0000
Subject: [PATCH] Sync commits from OpenDS by matthew_swift
---
sdk/src/com/sun/opends/sdk/util/Functions.java | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/sdk/src/com/sun/opends/sdk/util/Functions.java b/sdk/src/com/sun/opends/sdk/util/Functions.java
index d90d987..7892222 100644
--- a/sdk/src/com/sun/opends/sdk/util/Functions.java
+++ b/sdk/src/com/sun/opends/sdk/util/Functions.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2009 Sun Microsystems, Inc.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
*/
package com.sun.opends.sdk.util;
@@ -174,6 +174,17 @@
}
};
+ private static final Function<Object, Object, Void> IDENTITY =
+ new Function<Object, Object, Void>()
+ {
+
+ public Object apply(Object value, Void p)
+ {
+ return value;
+ }
+
+ };
+
/**
@@ -204,6 +215,23 @@
/**
+ * Returns a function which always returns the value that it was provided
+ * with.
+ *
+ * @param <M>
+ * The type of values transformed by this function.
+ * @return A function which always returns the value that it was provided
+ * with.
+ */
+ @SuppressWarnings("unchecked")
+ public static <M> Function<M, M, Void> identityFunction()
+ {
+ return (Function<M, M, Void>) IDENTITY;
+ }
+
+
+
+ /**
* Returns a function which converts a {@code String} to lower case using
* {@link StaticUtils#toLowerCase} and then trims it.
*
--
Gitblit v1.10.0