Commits

Bogdan Mart committed 08bb0e5 Merge

Merge

  • Participants
  • Parent commits bfa74ac, 3c91bbe

Comments (0)

Files changed (1)

src/main/java/com/innahema/collections/query/queriables/Queryable.java

     /**
      * Quryable sequence of zero elements
      * @return {@link Queryable} wrapped around {@link EmptyIterable#instance() instance} of type {@link EmptyIterable}
-     * @param <T> geneic type
+     * @param <T> generic type
      */
     @SuppressWarnings("unchecked")
     public static <T> Queryable<T> empty(){
      * converts array to Queriable.
      * <br>
      * <i>Note -- all operations will be performed  around original <b>array</b>.</i>
+     * @param <T> generic type
+     * @param arr sequence of elements with type T
      * @return {@link Queryable Queryable&lt;T&gt;} wrapped around {@link com.innahema.collections.query.iterables.ArrayIterable ArrayIterable&lt;T&gt;}
      */
     @SuppressWarnings("unchecked")
     }
 
     /**
-     * <font color='#FF8C00'>Caution!</font> Can  iterate only once.
+     * <span style="color: red">Caution!</span> Can  iterate only once.
      * Use {@link Queryable#cache()} to iterate many times
-     * @return ireable that simply returns provided itarator in it's {@link Iterable#iterator()} method
+     * @param <T> generic type
+     * @param iter iterator on a collection to iterate
+     * @return iterable that simply returns provided iterator in it's {@link Iterable#iterator()} method
      */
     public static <T> Queryable<T> from(Iterator<T> iter){
         return from(new IteratorIterable<T>(iter));
      * @param start value of first element
      * @param count number of elements in sequence
      * @param <T> {@link Number} type
+     * @return instance of queryable with range of elements with type T
      */
     public static <T extends Number & Comparable<T>> Queryable<T> range(T start,long count) {
         T one = new Arithmetic<T>(start) // simply sampling our type
      * @param count number of elements in sequence
      * @param step amount on whitch to increase <b>each</b> next value
      * @param <T> {@link Number} type
+     * @return instance of queryable with range of elements with type T
      */
     public static <T extends Number & Comparable<T>> Queryable<T> range(final T start,final long count,final T step) {
         return from(new Iterable<T>() {
      * Projects each element of a sequence into a new form.
      * @param converter function to perform conversion
      * @param <TTo> Type of resulting elements
+     * @return instance of queryable with map iterator in it
      */
     @SuppressWarnings("unchecked")
     public <TTo> Queryable<TTo> map(Converter<T, TTo> converter) {
      * Projects each element of a sequence into a new form.
      * @param converter function to perform conversion
      * @param <TTo> Type of resulting elements
+     * @return instance of queryable with new collection using map function
      */
     @SuppressWarnings("unchecked")
     public <TTo> Queryable<TTo> mapMany(Converter<T, Iterable<TTo>> converter) {
      * It's a shortcut for method {@link Queryable#map}.
      * @param converter function to perform conversion
      * @param <T2> Type of resulting elements
+     * @return new instance of queryable with collection of converted items
      */
     public final <T2> Queryable<T2> select(Converter<T,T2> converter){
         return map(converter);
     //-------------------------------
 
     /**
-     * Leaves no diplicates in sequence.<br>
+     * Leaves no duplicates in sequence.<br>
      * {@link Object#hashCode()} and {@link Object#equals(Object)} are used <br>
-     * <font color="red"><b>Warning</b></font> this call finalizes collection
+     * <b style="color: red">Warning</b> this call finalizes collection
+     * @return queryable with no duplicates
      */
     public Queryable<T> distinct() {
         HashSet<T> s = new HashSet<T>();
      * Leaves no diplicates in sequence.<br>
      * {@link Object#hashCode()} and {@link Object#equals(Object)} are used.<br>
      * <b style="color: red">Caution</b> this is not final api, in final variant there will be only {@link  Queryable#distinct()} method
-     */
+     * @return queryable with no duplicates
+     * */
     @Deprecated
     public Queryable<T> distinct2() {
         final HashSet<T> s = new HashSet<T>();
      * Leaves no duplicates in sequence.<br>
      * {@link Object#hashCode()} and {@link Object#equals(Object)} are used.<br>
      * <b style="color: red">Caution</b> this is not final api, in final variant there will be only {@link  Queryable#distinct()} method
+     * @return queryable with no duplicates
      */
     @Deprecated
     public Queryable<T> distinct3() {
 
     /**
      * Determines whether all elements of a sequence satisfy a condition.
+     * @param condition predicate to express an clause to select elements
      * @return true if every element of the sequence sequence passes the test in the specified predicate,
      *         or if the sequence is empty; otherwise, false.
      */
 
     /**
      * Determines if a sequence contains any elements.
+     * @return true if collection have at least one element that accepts condition
      */
     public boolean any(){
         return collection.iterator().hasNext();
 
     /**
      * Determines if any element of a sequence satisfies a condition.
+     * @param condition predicate to express an clause to check
+     * @return true if collection have at least one element that accepts condition
      */
     public boolean any(@NotNull Predicate<T> condition){
         for (T obj : collection)
 
     /**
      * Determines whether a sequence contains a specified element.
+     * @param value element to check similar values in collection
+     * @return true if collection have an element equal to <b>value</b>
      * it redirects to {@link Queryable#contains(Object)}
      */
     public final boolean any(T value){
     }
     /**
      * Determines whether a sequence contains a specified element.
+     * @param value element to check similar values in collection
+     * @return true if there is element equal to <b>value</b>
      */
     public boolean contains(T value){
         if(collection instanceof Collection)
             Collection<Tval> list = map.get(tk);
             if (list == null){
                 list =  collectionFactory != null
-                            ?collectionFactory.createInstance()
-                            :valUnique
-                                ?new HashSet<>()
-                                :new ArrayList<>();
+                        ?collectionFactory.createInstance()
+                        :valUnique
+                        ?new HashSet<>()
+                        :new ArrayList<>();
                 map.put(tk, list);
             }
             list.add(valueSelector==null?uncheckedCast(elt):valueSelector.convert(elt));
     /**
      * generate Queryable which holds it's elements after first iteration
      * aka. finalize chain
+     * @return queriable with CachedIterable in it {@link com.innahema.collections.query.iterables.CachedIterable}
      */
     public Queryable<T> cache()
     {
 
     /**
      * gets only first N elemeents
-     * @param amount amountofelemts to take
+     * @param amount Max amount of elements to select
      * @return Iterable of resulting size or less
      */
     public Queryable<T> take(final int amount)
 
     /**
      * return elements while as long as condition is true
+     * @param amount number of elements to select
+     * @return an queryable with intergated contidion to stop
      */
     public Queryable<T> skip(final int amount)
     {
      * <br>
      * If <b>objects</b> implement {@link java.lang.Comparable}, than {@link java.util.TreeSet} will be used internally,
      * {@link java.util.HashSet} otherwise.
+     * @param <T> generic type
      * @param first  sequence to be intersected with <b>second</b>
      * @param second sequence to intersect with.
      *               It's expected that this collection will be smaller than first one for performance reasons.
 
     /**
      * Produces the collection union of two sequences one from which is already existing
+     * @param other sequence to unite with.
      * @return Sequens of element that presents in both input seuences without repeats
      */
     public Queryable<T> union(Iterable<T> other){
     //---------------------------------
     /**
      * Produces the collection union of two sequences
+     * @param <T> generic type
+     * @param first  sequence to be united with <b>second</b>
+     * @param second sequence to unite with.
      * @return Sequens of element that presents in both input seuences without repeats
      */
 
 
     /**
      * Produces the collection concatenation of two sequences one from which is already existing
+     * @param other sequence to concatenate with.
      * @return Sequens of element that presents in both input seuences
      */
     public Queryable<T> concat(Iterable<T> other){
     //---------------------------------
     /**
      * Produces the collection union of two sequences
+     * @param <T> generic type
+     * @param first  sequence to be concatenated with <b>second</b>
+     * @param second sequence to concatenate with.
      * @return Sequens of element that presents in both input seuences
      */
 
     }
 
     /**
-     * Performs the given {@link com.innahema.collections.query.functions.Action1 action} for each element of the {@code Queriable}
+     * Performs the given {@link com.innahema.collections.query.functions.Action1 action} for each element of the {@code Queryable}
      * until all elements have been processed or the action throws an
      * exception. R stands for Retrolambda
+     * @param action Action to do with all elements
      */
     public void forEachR(Action1<? super T> action) {
         NullArgumentException.test(action,"action");