Java Doc for Algorithms.java in  » Development » jga-Generic-Algorithms » net » sf » jga » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » jga Generic Algorithms » net.sf.jga.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sf.jga.util.Algorithms

Algorithms
public class Algorithms (Code)
Facade for the Algorithms adapted from STL, defined to work primarily with collections. These algorithms are adapted from STL, with modifications to be consistent with typical java practice. For example, typical STL algorithms are defined with pairs of iterators defining a half-open range over some implied collection. It works in C++ because the STL iterators can be compared for equality. Java iterators are not guaranteed to be comparable to each other by contract, so the same signatures wouldn't work.

Typically, where an STL algorithm would take a pair of iterators, we'll take a collection. Where an STL algorithm would return an iterator, we'll return an iterator. Note that it will always be java.lang.Iterator when using this class: for some of the more powerful uses, use the Iterators class, which will often return an implementation of Iterator that is tailored for the semantics of the algorithm that was called.

The algorithms in this class and the same set of algorithms in the Iterators class will always return the same results when called with identical arguments.

Copyright © 2003-2005 David A. Hall
author:
   David A. Hall





Method Summary
public static  Taccumulate(Class<T> type, Collection<T> c)
     Adds each number in the collection, returning the sum. the final sum.
public static  Taccumulate(Class<T> type, Collection<T> c, BinaryFunctor<T, T, T> fn)
     Applies the binary functor to each number in the collection, returning the final result.
public static  Taccumulate(Collection<T> c, T initial, BinaryFunctor<T, T, T> fn)
     Applies the binary functor to each element in the collection, returning the final result.
public static  booleanaddAll(Collection<? super T> cout, Iterator<T> iter)
     Adds all of the elements of the iterator to the collection.
public static  TCollectionappend(TCollection cout, Iterator<T> iter)
     Adds all of the elements of the iterator to the collection and returns the collection.
public static  TCollectionappend(TCollection cout, T... values)
     Adds all of the arguments to the collection and returns the collection.
public static  longcount(Collection<? extends T> collection, T value)
    
public static  longcount(Collection<? extends T> collection, Equality<T> eq, T value)
     Counts the number of occurrences of value in the collection, using the given equality operator.
public static  longcount(Collection<? extends T> collection, UnaryFunctor<T, Boolean> eq)
     Counts the items in the collection for which the given function returns true.
public static  booleanequal(Collection<? extends T> c1, Collection<? extends T> c2)
     Returns true if the two collections are equal.
public static  booleanequal(Collection<? extends T> c1, Collection<? extends T> c2, Comparator<T> comp)
    
public static  booleanequal(Collection<? extends T> c1, Collection<? extends T> c2, BinaryFunctor<T, T, Boolean> eq)
     Returns true if the two collections are equal, using the given functor to compare the elements in each collection.
public static  Iterator<T>find(Collection<? extends T> collection, T value)
     Finds an arbitrary value in a collection using the equals() method. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value.
public static  Iterator<T>find(Collection<? extends T> collection, T value, Equality<T> eq)
     Finds an arbitrary value in a collection using the given Equality operator. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value.
public static  Iterator<T>find(Collection<? extends T> collection, UnaryFunctor<T, Boolean> fn)
     Finds a value in a collection for which the given function returns TRUE. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value.
public static  Iterator<T>findAdjacent(Collection<? extends T> collection)
     Finds adjacent pairs of equivalent values in a collection using the equals() method. an iterator from the collection whose next() [if it hasNext()]will return the first of a pair of adjacent values.
public static  Iterator<T>findAdjacent(Collection<? extends T> c, BinaryFunctor<T, T, Boolean> bf)
     Finds adjacent pairs of equivalent values in a collection for which the given function returns TRUE. an iterator from the collection whose next() [if it hasNext()]will return the first of a pair of adjacent values.
public static  Iterator<T>findElement(Collection<? extends T> c, Collection<? extends T> desired)
     Finds any value from the given collection using the collection's contains() method. an iterator from the first collection whose next() [if it hasNext()] will returnthe first instance of any value found in the second collection.
public static  Iterator<T>findElement(Collection<? extends T> c, Collection<? extends T> desired, BinaryFunctor<T, T, Boolean> fn)
     Finds any value from the given collection using the given functor to determine equivalence. Each item in the first collection will be compared to every item in the second collection using the given functor, stopping when the first collection is exhausted or when any pair returns TRUE. an iterator from the first collection whose next() [if it hasNext()] will returnthe first instance of any value in the second collection, where equivelency is determinedby the given functor.
public static  Iterator<T>findRepeated(Collection<? extends T> c, int n, T value)
     Finds arbitrary length runs of a given value in a collection using the equals() method.
public static  Iterator<T>findRepeated(Collection<? extends T> c, int n, T value, Equality<T> eq)
     Finds arbitrary length runs of a given value in a collection using the given Equality operator.
public static  Iterator<T>findRepeated(Collection<? extends T> c, int n, UnaryFunctor<T, Boolean> eq)
     Finds arbitrary length runs of values in a collection for which the given functor returns TRUE.
public static  UnaryFunctor<T, R>forEach(Collection<? extends T> c, UnaryFunctor<T, R> fn)
     Applies the given UnaryFunctor to every element in the collection, and returns the Functor.
public static  booleanlessThan(Collection<? extends T> c1, Collection<? extends T> c2)
     Returns true if the first collection is lexically less than the second, using the default comparison operation to compare the elements in each collection.
public static  booleanlessThan(Collection<? extends T> c1, Collection<? extends T> c2, Comparator<T> comp)
     Returns true if the first collection is lexically less than the second, using the given comparator to compare the elements in each collection.
public static  booleanlessThan(Collection<? extends T> c1, Collection<? extends T> c2, BinaryFunctor<T, T, Boolean> lt)
     Returns true if the first collection is lexically less than the second, using the given operator to compare the elements in each collection.
public static  Iterator<T>match(Collection<? extends T> c, Collection<? extends T> pattern)
     Finds the given pattern in the collection using the equals method. an iterator from the first collection whose next() [if ithasNext()] will return the first element of a sequence that matchesthe entire contents of the second collection.
public static  Iterator<T>match(Collection<? extends T> c, Collection<? extends T> pattern, BinaryFunctor<T, T, Boolean> eq)
     Finds the given pattern in the collection using the given functor to determine equivalence. an iterator from the first collection whose next() [if ithasNext()] will return the first element of a sequence that matchesthe entire contents of the second collection.
public static  Iterator<T>maximum(Collection<? extends T> c)
     Finds the position of the maximum value in a collection using the natural ordering of the collection's elements.
public static  Iterator<T>maximum(Collection<? extends T> c, Comparator<T> comp)
     Finds the position of the maximum value in a collection using the given comparator.
public static  Iterator<T>maximum(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)
     Finds the position of the maximum value in a collection using the given functor to compare elements.
public static  TmaximumValue(Collection<? extends T> c)
     Finds the maximum value in a collection using the natural ordering of the collection's elements.
public static  TmaximumValue(Collection<? extends T> c, Comparator<T> comp)
     Finds the maximum value in a collection using the given comparator.
public static  TmaximumValue(Collection<? extends T> c, BinaryFunctor<T, T, T> fn)
     Finds the maximum value in a collection using the given functor to compare elements.
public static  Collection<? super T>mergeCopy(Collection<? extends T> cin1, Collection<? extends T> cin2, Collection<? super T> cout)
    
public static  Collection<? super T>mergeCopy(Collection<? extends T> cin1, Collection<? extends T> cin2, Collection<? super T> cout, Comparator<T> comp)
    
public static  Iterator<T>minimum(Collection<? extends T> c)
     Finds the position of the minimum value in a collection using the natural ordering of the collection's elements.
public static  Iterator<T>minimum(Collection<? extends T> c, Comparator<T> comp)
     Finds the position of the minimum value in a collection using the given comparator.
public static  Iterator<T>minimum(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)
     Finds the position of the minimum value in a collection using the given functor to compare elements.
public static  TminimumValue(Collection<? extends T> c)
     Finds the minimum value in a collection using the natural ordering of the collection's elements.
public static  TminimumValue(Collection<? extends T> c, Comparator<T> comp)
     Finds the minimum value in a collection using the given comparator.
public static  TminimumValue(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)
     Finds the minimum value in a collection using the given functor to compare elements.
public static  Iterator<T>mismatch(Collection<? extends T> c, Collection<? extends T> pattern)
     Finds the point at which two collections differ, using NotEqualTo. an iterator from the first collection whose next() [if ithasNext()] will return the first element in the collection that doesnot equal the corresponding element in the pattern.
public static  Iterator<T>mismatch(Collection<? extends T> c, Collection<? extends T> pattern, BinaryFunctor<T, T, Boolean> neq)
     Finds the point at which two collections differ, using the given functor an iterator from the first collection whose next() [if ithasNext()] will return the first element in the collection for which thegiven function returns TRUE when given the element and the correspondindelement in the pattern.
public static  voidremoveAll(List<? extends T> lin, T value)
    
public static  voidremoveAll(List<? extends T> lin, T value, Equality<T> eq)
    
public static  voidremoveAll(List<? extends T> lin, UnaryFunctor<T, Boolean> uf)
    
public static  Collection<? super T>removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, T value)
    
public static  Collection<? super T>removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, T value, Equality<T> eq)
    
public static  Collection<? super T>removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, UnaryFunctor<T, Boolean> pred)
     Copies each element in the input collection except those for which the given function returns TRUE to the output collection.
public static  voidreplaceAll(List<T> lin, UnaryFunctor<T, Boolean> uf, T value)
     Tests each element in the list, and replaces elements that pass with the given value.
public static  Collection<? super T>replaceAllCopy(Collection<? extends T> cin, Collection<? super T> cout, UnaryFunctor<T, Boolean> test, T value)
     Copies each element in the input collection to the output collection, except that those elements that pass the given test are replaced with the constant value.
public static  voidtransform(List<T> lin, UnaryFunctor<T, T> uf)
     Applies the UnaryFunctor to each element in the list, and replaces each element with the result.
public static  Collection<? super R>transformCopy(Collection<? extends T> cin, Collection<? super R> cout, UnaryFunctor<T, R> uf)
     Applies the UnaryFunctor to each element in the input collection, and appends the result to the output collection.
public static  Collection<? super R>transformCopy(Collection<? extends T1> c1, Collection<? extends T2> c2, Collection<? super R> cout, BinaryFunctor<T1, T2, R> bf)
     Applies the BinaryFunctor to corresponding elements of the two input collections, and appends the result to the output collection.
public static  voidunique(List<? extends T> lin)
    
public static  voidunique(List<? extends T> lin, BinaryFunctor<T, T, Boolean> eq)
    
public static  CTuniqueCopy(Collection<? extends T> cin, CT cout)
     Copies the elements from the input collection to the output collection, skipping adjacent duplicate elements.
public static  CTuniqueCopy(Collection<? extends T> cin, CT cout, BinaryFunctor<T, T, Boolean> eq)
     Copies the elements from the input collection to the output collection, skipping adjacent duplicate elements.



Method Detail
accumulate
public static T accumulate(Class<T> type, Collection<T> c)(Code)
Adds each number in the collection, returning the sum. the final sum. If the collection is empty, then zero isreturned



accumulate
public static T accumulate(Class<T> type, Collection<T> c, BinaryFunctor<T, T, T> fn)(Code)
Applies the binary functor to each number in the collection, returning the final result. Along with each number is passed the result of the previous call of the functor (or zero for the first call to the functor). The elements in the collection are always passed in the 2nd postion. the final result. If the collection is empty, then zero isreturned



accumulate
public static T accumulate(Collection<T> c, T initial, BinaryFunctor<T, T, T> fn)(Code)
Applies the binary functor to each element in the collection, returning the final result. Along with each element is passed the result of the previous call of the functor (or the initial value for the first call to the functor). The elements in the collection are always passed in the 2nd postion. the final result. If the collection is empty, then the initialvalue is returned



addAll
public static boolean addAll(Collection<? super T> cout, Iterator<T> iter)(Code)
Adds all of the elements of the iterator to the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception will be thrown. This is an augmentation of the Collection.addAll(Collection) API method.



append
public static TCollection append(TCollection cout, Iterator<T> iter)(Code)
Adds all of the elements of the iterator to the collection and returns the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception is thrown.



append
public static TCollection append(TCollection cout, T... values)(Code)
Adds all of the arguments to the collection and returns the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then the runtime exception thrown. A similar method exists in Java 1.5, although it returns boolean rather than the collection.



count
public static long count(Collection<? extends T> collection, T value)(Code)
Counts the number of occurrences of value in the collection, using the equals() method of the value the number of instances found



count
public static long count(Collection<? extends T> collection, Equality<T> eq, T value)(Code)
Counts the number of occurrences of value in the collection, using the given equality operator. the number of instances found



count
public static long count(Collection<? extends T> collection, UnaryFunctor<T, Boolean> eq)(Code)
Counts the items in the collection for which the given function returns true. the number of instances found



equal
public static boolean equal(Collection<? extends T> c1, Collection<? extends T> c2)(Code)
Returns true if the two collections are equal. true if the two collections are equal



equal
public static boolean equal(Collection<? extends T> c1, Collection<? extends T> c2, Comparator<T> comp)(Code)
Returns true if the two collections are equal, using the given comparator to compare the elements in each collection true if the two collections are equal.



equal
public static boolean equal(Collection<? extends T> c1, Collection<? extends T> c2, BinaryFunctor<T, T, Boolean> eq)(Code)
Returns true if the two collections are equal, using the given functor to compare the elements in each collection. The functor is expected to evaluate its two argments and return true if they are "equal", therefore this method returns true if the iterations contain the same number of elements and if the functor returns true for all pairs of elements. true if the two collections are equal



find
public static Iterator<T> find(Collection<? extends T> collection, T value)(Code)
Finds an arbitrary value in a collection using the equals() method. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value. If the value is not in thecollection, then the returned iterator's hasNext() will report false.



find
public static Iterator<T> find(Collection<? extends T> collection, T value, Equality<T> eq)(Code)
Finds an arbitrary value in a collection using the given Equality operator. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value. If the value is not in thecollection, then the returned iterator's hasNext() will report false.



find
public static Iterator<T> find(Collection<? extends T> collection, UnaryFunctor<T, Boolean> fn)(Code)
Finds a value in a collection for which the given function returns TRUE. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the value. If the value is not in thecollection, then the returned iterator's hasNext() will report false.



findAdjacent
public static Iterator<T> findAdjacent(Collection<? extends T> collection)(Code)
Finds adjacent pairs of equivalent values in a collection using the equals() method. an iterator from the collection whose next() [if it hasNext()]will return the first of a pair of adjacent values. If no pair of valuesexists in the collection, then the returned iterator's hasNext() willreport false.



findAdjacent
public static Iterator<T> findAdjacent(Collection<? extends T> c, BinaryFunctor<T, T, Boolean> bf)(Code)
Finds adjacent pairs of equivalent values in a collection for which the given function returns TRUE. an iterator from the collection whose next() [if it hasNext()]will return the first of a pair of adjacent values. If no pair of valuesexists in the collection, then the returned iterator's hasNext() willreport false.



findElement
public static Iterator<T> findElement(Collection<? extends T> c, Collection<? extends T> desired)(Code)
Finds any value from the given collection using the collection's contains() method. an iterator from the first collection whose next() [if it hasNext()] will returnthe first instance of any value found in the second collection. If no such value isfound in the first collection, then the returned iterator's hasNext() will report false.



findElement
public static Iterator<T> findElement(Collection<? extends T> c, Collection<? extends T> desired, BinaryFunctor<T, T, Boolean> fn)(Code)
Finds any value from the given collection using the given functor to determine equivalence. Each item in the first collection will be compared to every item in the second collection using the given functor, stopping when the first collection is exhausted or when any pair returns TRUE. an iterator from the first collection whose next() [if it hasNext()] will returnthe first instance of any value in the second collection, where equivelency is determinedby the given functor. If no such value is found in the first collection, then the returnediterator's hasNext() will report false.



findRepeated
public static Iterator<T> findRepeated(Collection<? extends T> c, int n, T value)(Code)
Finds arbitrary length runs of a given value in a collection using the equals() method. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values. an iterator from the collection whose next() [if it hasNext()]will return the first of n adjacent instances of value. If no run ofvalues of the requested length exist in the collection, then the returnediterator's hasNext() will report false.



findRepeated
public static Iterator<T> findRepeated(Collection<? extends T> c, int n, T value, Equality<T> eq)(Code)
Finds arbitrary length runs of a given value in a collection using the given Equality operator. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values. an iterator from the collection whose next() [if it hasNext()]will return the first of n adjacent instances of value. If no run ofvalues of the requested length exist in the collection, then the returnediterator's hasNext() will report false.



findRepeated
public static Iterator<T> findRepeated(Collection<? extends T> c, int n, UnaryFunctor<T, Boolean> eq)(Code)
Finds arbitrary length runs of values in a collection for which the given functor returns TRUE. Runs of length zero are well-defined: every iteration begins with a run of length zero of all possible values. an iterator from the collection whose next() [if it hasNext()]will return the first of n adjacent instances of value. If no run ofvalues of the requested length exist in the collection, then the returnediterator's hasNext() will report false.



forEach
public static UnaryFunctor<T, R> forEach(Collection<? extends T> c, UnaryFunctor<T, R> fn)(Code)
Applies the given UnaryFunctor to every element in the collection, and returns the Functor. This is useful when the Functor gathers information on each successive call. the functor, after it has been called once for every element



lessThan
public static boolean lessThan(Collection<? extends T> c1, Collection<? extends T> c2)(Code)
Returns true if the first collection is lexically less than the second, using the default comparison operation to compare the elements in each collection. true if c1 < c2



lessThan
public static boolean lessThan(Collection<? extends T> c1, Collection<? extends T> c2, Comparator<T> comp)(Code)
Returns true if the first collection is lexically less than the second, using the given comparator to compare the elements in each collection. true if c1 < c2



lessThan
public static boolean lessThan(Collection<? extends T> c1, Collection<? extends T> c2, BinaryFunctor<T, T, Boolean> lt)(Code)
Returns true if the first collection is lexically less than the second, using the given operator to compare the elements in each collection. The first is less than the second if it is not longer than the second and if the first corresponding element that is not equal is less. true if c1 < c2



match
public static Iterator<T> match(Collection<? extends T> c, Collection<? extends T> pattern)(Code)
Finds the given pattern in the collection using the equals method. an iterator from the first collection whose next() [if ithasNext()] will return the first element of a sequence that matchesthe entire contents of the second collection. If no such match isfound in the first collection, then the returned iterator's hasNext()will report false. If the pattern is empty, then the iterator pointsto the first element in the collection.



match
public static Iterator<T> match(Collection<? extends T> c, Collection<? extends T> pattern, BinaryFunctor<T, T, Boolean> eq)(Code)
Finds the given pattern in the collection using the given functor to determine equivalence. an iterator from the first collection whose next() [if ithasNext()] will return the first element of a sequence that matchesthe entire contents of the second collection. If no such match isfound in the first collection, then the returned iterator's hasNext()will report false. If the pattern is empty, then the iterator pointsto the first element in the collection.



maximum
public static Iterator<T> maximum(Collection<? extends T> c)(Code)
Finds the position of the maximum value in a collection using the natural ordering of the collection's elements. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the maximum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



maximum
public static Iterator<T> maximum(Collection<? extends T> c, Comparator<T> comp)(Code)
Finds the position of the maximum value in a collection using the given comparator. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the maximum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



maximum
public static Iterator<T> maximum(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)(Code)
Finds the position of the maximum value in a collection using the given functor to compare elements. The functor is presumed to return the greater of its two arguments. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the maximum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



maximumValue
public static T maximumValue(Collection<? extends T> c)(Code)
Finds the maximum value in a collection using the natural ordering of the collection's elements. the maximum value found in the collection



maximumValue
public static T maximumValue(Collection<? extends T> c, Comparator<T> comp)(Code)
Finds the maximum value in a collection using the given comparator. the maximum value found in the collection



maximumValue
public static T maximumValue(Collection<? extends T> c, BinaryFunctor<T, T, T> fn)(Code)
Finds the maximum value in a collection using the given functor to compare elements. The functor is presumed to return the greater of its two arguments. the maximum value found in the collection



mergeCopy
public static Collection<? super T> mergeCopy(Collection<? extends T> cin1, Collection<? extends T> cin2, Collection<? super T> cout)(Code)
merges two collections, appending values to the output collection



mergeCopy
public static Collection<? super T> mergeCopy(Collection<? extends T> cin1, Collection<? extends T> cin2, Collection<? super T> cout, Comparator<T> comp)(Code)
merges two collections using the given comparator, appending values to the output collection



minimum
public static Iterator<T> minimum(Collection<? extends T> c)(Code)
Finds the position of the minimum value in a collection using the natural ordering of the collection's elements. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the minimum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



minimum
public static Iterator<T> minimum(Collection<? extends T> c, Comparator<T> comp)(Code)
Finds the position of the minimum value in a collection using the given comparator. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the minimum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



minimum
public static Iterator<T> minimum(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)(Code)
Finds the position of the minimum value in a collection using the given functor to compare elements. The functor is presumed to return the lesser of its two arguments. an iterator from the collection whose next() [if it hasNext()]will return the first instance of the minimum value in the collection.If the collection is empty, then the returned iterator's hasNext() willreport false.



minimumValue
public static T minimumValue(Collection<? extends T> c)(Code)
Finds the minimum value in a collection using the natural ordering of the collection's elements. the minimum value found in the collection



minimumValue
public static T minimumValue(Collection<? extends T> c, Comparator<T> comp)(Code)
Finds the minimum value in a collection using the given comparator. the minimum value found in the collection



minimumValue
public static T minimumValue(Collection<? extends T> c, BinaryFunctor<T, T, T> bf)(Code)
Finds the minimum value in a collection using the given functor to compare elements. The functor is presumed to return the lesser of its two arguments. the minimum value found in the collection



mismatch
public static Iterator<T> mismatch(Collection<? extends T> c, Collection<? extends T> pattern)(Code)
Finds the point at which two collections differ, using NotEqualTo. an iterator from the first collection whose next() [if ithasNext()] will return the first element in the collection that doesnot equal the corresponding element in the pattern. If the patternmatches the collection but is longer, than the returned iterator'shasNext() will report false. If the pattern is empty, then the iteratorpoints to the first element in the collection.



mismatch
public static Iterator<T> mismatch(Collection<? extends T> c, Collection<? extends T> pattern, BinaryFunctor<T, T, Boolean> neq)(Code)
Finds the point at which two collections differ, using the given functor an iterator from the first collection whose next() [if ithasNext()] will return the first element in the collection for which thegiven function returns TRUE when given the element and the correspondindelement in the pattern. If the pattern matches the collection but islonger, than the returned iterator's hasNext() will report false. If thepattern is empty, then the iterator points to the first element in thecollection.



removeAll
public static void removeAll(List<? extends T> lin, T value)(Code)
removes all instances of the given element from the list



removeAll
public static void removeAll(List<? extends T> lin, T value, Equality<T> eq)(Code)
removes all instances of the given element from the list



removeAll
public static void removeAll(List<? extends T> lin, UnaryFunctor<T, Boolean> uf)(Code)
removes all elements from the list for which the functor returns TRUE



removeAllCopy
public static Collection<? super T> removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, T value)(Code)
Copies each element in the input collection except those equal to the given value to the output collection,



removeAllCopy
public static Collection<? super T> removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, T value, Equality<T> eq)(Code)
Copies each element in the input collection except those equal to the given value (using the given Equality operator) to the output collection,



removeAllCopy
public static Collection<? super T> removeAllCopy(Collection<? extends T> cin, Collection<? super T> cout, UnaryFunctor<T, Boolean> pred)(Code)
Copies each element in the input collection except those for which the given function returns TRUE to the output collection.



replaceAll
public static void replaceAll(List<T> lin, UnaryFunctor<T, Boolean> uf, T value)(Code)
Tests each element in the list, and replaces elements that pass with the given value. This method would, in an ideal world, belong in the Collections class, as its signature is more like the algorithm methods in that class than in Algorithms.



replaceAllCopy
public static Collection<? super T> replaceAllCopy(Collection<? extends T> cin, Collection<? super T> cout, UnaryFunctor<T, Boolean> test, T value)(Code)
Copies each element in the input collection to the output collection, except that those elements that pass the given test are replaced with the constant value.



transform
public static void transform(List<T> lin, UnaryFunctor<T, T> uf)(Code)
Applies the UnaryFunctor to each element in the list, and replaces each element with the result. This method would, in an ideal world, belong in the Collections class, as its signature is more like the algorithm methods in that class than in Algorithms.



transformCopy
public static Collection<? super R> transformCopy(Collection<? extends T> cin, Collection<? super R> cout, UnaryFunctor<T, R> uf)(Code)
Applies the UnaryFunctor to each element in the input collection, and appends the result to the output collection. The output collection will generally grow as a result of this operation (in contrast with the STL transform operation, which will not by itself change the size of the output collection)



transformCopy
public static Collection<? super R> transformCopy(Collection<? extends T1> c1, Collection<? extends T2> c2, Collection<? super R> cout, BinaryFunctor<T1, T2, R> bf)(Code)
Applies the BinaryFunctor to corresponding elements of the two input collections, and appends the result to the output collection. The output collection will generally grow as a result of this operation (in contrast with the STL transform operation, which will not by itself change the size of the output collection)



unique
public static void unique(List<? extends T> lin)(Code)
removes all adjacent duplicate values in the given list, using equals() to compare adjacent elements



unique
public static void unique(List<? extends T> lin, BinaryFunctor<T, T, Boolean> eq)(Code)
removes all adjacent duplicate values in the given list, using the given functor to compare adjacent elements



uniqueCopy
public static CT uniqueCopy(Collection<? extends T> cin, CT cout)(Code)
Copies the elements from the input collection to the output collection, skipping adjacent duplicate elements.



uniqueCopy
public static CT uniqueCopy(Collection<? extends T> cin, CT cout, BinaryFunctor<T, T, Boolean> eq)(Code)
Copies the elements from the input collection to the output collection, skipping adjacent duplicate elements.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.