Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Apr 13, 2019
2 parents dc9c4b4 + dc1f1ad commit 341af0d
Show file tree
Hide file tree
Showing 38 changed files with 108 additions and 400 deletions.
10 changes: 0 additions & 10 deletions src/main/java/org/cactoos/collection/CollectionOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.cactoos.collection;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import org.cactoos.iterable.IterableOf;

Expand Down Expand Up @@ -56,15 +55,6 @@ public CollectionOf(final T... array) {
this(new IterableOf<>(array));
}

/**
* Ctor.
* @param src An {@link Iterator}
* @since 0.21
*/
public CollectionOf(final Iterator<T> src) {
this(new IterableOf<>(src));
}

/**
* Ctor.
* @param src An {@link Iterable}
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cactoos/collection/Filtered.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.cactoos.collection;

import java.util.Iterator;
import org.cactoos.Func;
import org.cactoos.iterable.IterableOf;

Expand All @@ -48,16 +47,6 @@ public Filtered(final Func<X, Boolean> func, final X... src) {
this(func, new IterableOf<>(src));
}

/**
* Ctor.
* @param src Source collection
* @param func Filter function
* @since 0.23
*/
public Filtered(final Func<X, Boolean> func, final Iterator<X> src) {
this(func, new IterableOf<>(src));
}

/**
* Ctor.
* @param src Source collection
Expand Down
26 changes: 8 additions & 18 deletions src/main/java/org/cactoos/collection/Mapped.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ public Mapped(final Func<X, Y> fnc, final X... src) {
this(fnc, new IterableOf<>(src));
}

/**
* Ctor.
* @param src Source collection
* @param fnc Func
* @since 0.23
*/
public Mapped(final Func<X, Y> fnc, final Iterator<X> src) {
this(fnc, new IterableOf<>(src));
}

/**
* Ctor.
* @param src Source collection
Expand Down Expand Up @@ -96,8 +86,8 @@ public boolean isEmpty() {
@Override
public boolean contains(final Object item) {
return new CollectionOf<>(
new org.cactoos.iterator.Mapped<>(
fnc, src.iterator()
new org.cactoos.iterable.Mapped<>(
fnc, src
)
).contains(item);
}
Expand All @@ -110,17 +100,17 @@ public Iterator<Y> iterator() {
@Override
public Object[] toArray() {
return new CollectionOf<>(
new org.cactoos.iterator.Mapped<>(
fnc, src.iterator()
new org.cactoos.iterable.Mapped<>(
fnc, src
)
).toArray();
}
@Override
@SuppressWarnings("PMD.UseVarargs")
public <T> T[] toArray(final T[] array) {
return new CollectionOf<>(
new org.cactoos.iterator.Mapped<>(
fnc, src.iterator()
new org.cactoos.iterable.Mapped<>(
fnc, src
)
).toArray(array);
}
Expand All @@ -140,8 +130,8 @@ public boolean remove(final Object item) {
@Override
public boolean containsAll(final Collection<?> items) {
return new CollectionOf<>(
new org.cactoos.iterator.Mapped<>(
fnc, src.iterator()
new org.cactoos.iterable.Mapped<>(
fnc, src
)
).containsAll(items);
}
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/cactoos/collection/Solid.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ public Solid(final T... array) {
this(new IterableOf<>(array));
}

/**
* Ctor.
* @param src An {@link Iterator}
*/
public Solid(final Iterator<T> src) {
this(new IterableOf<>(src));
}

/**
* Ctor.
* @param src An {@link Iterator}
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cactoos/collection/Sorted.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import org.cactoos.list.ListOf;

Expand Down Expand Up @@ -82,16 +81,6 @@ public Sorted(final Comparator<T> cmp, final T... src) {
this(cmp, new CollectionOf<>(src));
}

/**
* Ctor.
* @param src The underlying collection
* @param cmp The comparator
* @since 0.23
*/
public Sorted(final Comparator<T> cmp, final Iterator<T> src) {
this(cmp, new CollectionOf<>(src));
}

/**
* Ctor.
* @param src The underlying collection
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/cactoos/collection/Sticky.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import org.cactoos.iterable.IterableOf;

/**
Expand All @@ -48,15 +47,6 @@ public Sticky(final E... items) {
this(new IterableOf<>(items));
}

/**
* Ctor.
* @param items The array
* @since 0.21
*/
public Sticky(final Iterator<E> items) {
this(new IterableOf<>(items));
}

/**
* Ctor.
* @param items The array
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/cactoos/collection/Synced.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import org.cactoos.iterable.IterableOf;

Expand Down Expand Up @@ -56,14 +55,6 @@ public Synced(final T... array) {
this(new IterableOf<>(array));
}

/**
* Ctor.
* @param src An {@link Iterator}
*/
public Synced(final Iterator<T> src) {
this(new IterableOf<>(src));
}

/**
* Ctor.
* @param src An {@link Iterable}
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cactoos/iterable/Cycled.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

package org.cactoos.iterable;

import java.util.Iterator;

/**
* Cycled Iterable.
*
Expand All @@ -46,15 +44,6 @@ public Cycled(final T... itr) {
this(new IterableOf<T>(itr));
}

/**
* Ctor.
* @param itr Iterable
* @since 0.21
*/
public Cycled(final Iterator<T> itr) {
this(new IterableOf<T>(itr));
}

/**
* Ctor.
* @param itr Iterable
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cactoos/iterable/Filtered.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.cactoos.iterable;

import java.util.Iterator;
import org.cactoos.Func;

/**
Expand Down Expand Up @@ -60,16 +59,6 @@ public Filtered(final Func<X, Boolean> fnc, final X... src) {
this(fnc, new IterableOf<>(src));
}

/**
* Ctor.
* @param fnc Predicate
* @param src Source iterable
* @since 0.21
*/
public Filtered(final Func<X, Boolean> fnc, final Iterator<X> src) {
this(fnc, new IterableOf<>(src));
}

/**
* Ctor.
* @param fnc Predicate
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/cactoos/iterable/Mapped.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/
package org.cactoos.iterable;

import java.util.Iterator;
import org.cactoos.Func;
import org.cactoos.text.TextOf;

Expand All @@ -48,15 +47,6 @@ public Mapped(final Func<X, Y> fnc, final X... src) {
this(fnc, new IterableOf<X>(src));
}

/**
* Ctor.
* @param fnc Func
* @param src Source iterable
*/
public Mapped(final Func<X, Y> fnc, final Iterator<X> src) {
this(fnc, new IterableOf<X>(src));
}

/**
* Ctor.
* @param fnc Func
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/cactoos/iterable/Matched.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ public final class Matched<X> implements Iterable<X> {
*/
private final Unchecked<Iterator<X>> mtr;

/**
* Ctor.
* @param fst The first iterator of duplex iterator.
* @param snd The second part of duplex iterator.
*/
public Matched(final Iterator<X> fst, final Iterator<X> snd) {
this(Object::equals, new IterableOf<>(fst), new IterableOf<>(snd));
}

/**
* Ctor.
* @param fst The first part of duplex iterator.
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cactoos/iterable/Shuffled.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
*/
package org.cactoos.iterable;

import java.util.Iterator;

/**
* Shuffled iterable.
*
Expand All @@ -45,15 +43,6 @@ public Shuffled(final T... src) {
this(new IterableOf<>(src));
}

/**
* Ctor.
* @param src The underlying iterable
* @since 0.23
*/
public Shuffled(final Iterator<T> src) {
this(new IterableOf<>(src));
}

/**
* Ctor.
* @param src The underlying iterable
Expand Down
13 changes: 8 additions & 5 deletions src/main/java/org/cactoos/iterator/TailOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import org.cactoos.collection.CollectionOf;
import org.cactoos.iterable.IterableOf;

/**
* Tail portion of the iterator.
Expand All @@ -49,11 +50,13 @@ public final class TailOf<T> implements Iterator<T> {
public TailOf(final int num, final Iterator<T> iterator) {
this.origin = new LinkedList<>(
new CollectionOf<>(
new HeadOf<>(
num,
new LinkedList<>(
new CollectionOf<>(iterator)
).descendingIterator()
new IterableOf<>(
new HeadOf<>(
num,
new LinkedList<>(
new CollectionOf<>(new IterableOf<>(iterator))
).descendingIterator()
)
)
)
).descendingIterator();
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/org/cactoos/list/Mapped.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
*/
package org.cactoos.list;

import java.util.Iterator;
import org.cactoos.Func;
import org.cactoos.iterable.IterableOf;
import org.cactoos.text.TextOf;

/**
Expand All @@ -39,16 +37,6 @@
*/
public final class Mapped<X, Y> extends ListEnvelope<Y> {

/**
* Ctor.
* @param src Source list
* @param fnc Func
* @since 0.21
*/
public Mapped(final Func<X, Y> fnc, final Iterator<X> src) {
this(fnc, new IterableOf<>(src));
}

/**
* Ctor.
* @param src Source iterable
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/cactoos/list/Shuffled.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -55,14 +54,6 @@ public Shuffled(final T... src) {
this(new ListOf<>(src));
}

/**
* Ctor.
* @param src The underlying collection
*/
public Shuffled(final Iterator<T> src) {
this(() -> src);
}

/**
* Ctor.
* @param src The underlying collection
Expand Down
Loading

1 comment on commit 341af0d

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 341af0d Apr 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 911-b9a58d58 discovered in src/main/java/org/cactoos/scalar/ItemAt.java and submitted as #1104. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.