Am 12.04.2015 um 13:14 schrieb Benedikt Ritter: > Hi, > > there is currently a discussion on github about the addition of a low level > utility class which helps to retrieve Threads [1]. The latest proposal is to > implement a predicate based approach for filtering threads [2]. My opinion > is, that we should not add such an API at all, because we would have to > revert it anyway, when we upgrade [lang] to Java 8. Further more I don't > think it is a good idea to add a generic Pedicate interface to [lang]. This > will only cause confusion for users already using Java 8. So if we really > want to add predicate based API in ThreadUtils, it should IMHO Look like this: > > Collection<Thread> ThreadUtils.findThreads(ThreadPredicate filter) > > public interface ThreadPredicate { > boolean test(Thread); > } > > Later we can change this to: > > Collection<Thread> > ThreadUtils.findThreads(java.util.function.Predicate<Thread> filter) > > public interface ThreadPredicate extends java.util.function.Predicate<Thread> > > I'd like to hear what others think about this.
It is indeed hard to design this API in a way that is compatible with Java 8 and earlier versions. Providing only a findThreads() method which takes a ThreadPredicate will not have much benefit on its own. Would we then also have to provide a set of default predicate implementations offering the functionality that was addressed in the original proposal? Oliver > > Regards, > Benedikt > > [1] https://github.com/apache/commons-lang/pull/61 > [2] https://github.com/salyh/commons-lang/pull/1 > > Send from my mobile device > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org