-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,787 additions
and
718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,8 @@ jobs: | |
- name: Test | ||
run: mvn clean test --errors --batch-mode | ||
- name: CodeCov | ||
uses: codecov/[email protected] | ||
if: matrix.os == 'ubuntu-18.04' && github.repository == 'yegor256/cactoos' | ||
timeout-minutes: 10 | ||
uses: codecov/codecov-action@v1 | ||
if: matrix.os == 'ubuntu-18.04' && matrix.java == 8 && github.repository == 'yegor256/cactoos' | ||
with: | ||
file: target/coverage/jacoco.xml | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017-2020 Yegor Bugayenko | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.cactoos.iterable; | ||
|
||
import org.cactoos.BiFunc; | ||
|
||
/** | ||
* Mapped with index iterable. | ||
* | ||
* <p> | ||
* There is no thread-safety guarantee. | ||
* @param <Y> Type of target item | ||
* @since 1.0.0 | ||
*/ | ||
public final class MappedWithIndex<Y> extends IterableEnvelope<Y> { | ||
/** | ||
* Ctor. | ||
* @param fnc Func | ||
* @param src Source iterable | ||
* @param <X> Type of source item | ||
*/ | ||
@SafeVarargs | ||
public <X> MappedWithIndex( | ||
final BiFunc<? super X, Integer, ? extends Y> fnc, | ||
final X... src | ||
) { | ||
this(fnc, new IterableOf<>(src)); | ||
} | ||
|
||
/** | ||
* Ctor. | ||
* @param fnc Func | ||
* @param src Source iterable | ||
* @param <X> Type of source item | ||
*/ | ||
public <X> MappedWithIndex( | ||
final BiFunc<? super X, Integer, ? extends Y> fnc, | ||
final Iterable<? extends X> src | ||
) { | ||
super( | ||
new IterableOf<>( | ||
() -> new org.cactoos.iterator.MappedWithIndex<>(fnc, src.iterator()) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017-2020 Yegor Bugayenko | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included | ||
* in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
package org.cactoos.iterator; | ||
|
||
import java.util.Iterator; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
import org.cactoos.BiFunc; | ||
|
||
/** | ||
* Mapped with index iterator. | ||
* | ||
* <p> | ||
* There is no thread-safety guarantee. | ||
* @param <Y> Type of target item | ||
* @since 1.0.0 | ||
*/ | ||
public final class MappedWithIndex<Y> extends IteratorEnvelope<Y> { | ||
/** | ||
* Ctor. | ||
* @param func Func | ||
* @param iterator Source iterator | ||
* @param <X> Type of item | ||
*/ | ||
public <X> MappedWithIndex( | ||
final BiFunc<? super X, Integer, ? extends Y> func, | ||
final Iterator<? extends X> iterator | ||
) { | ||
this( | ||
new AtomicInteger(-1), | ||
func, | ||
iterator | ||
); | ||
} | ||
|
||
/** | ||
* Privated Ctor. | ||
* @param indexcounter Index Counter | ||
* @param func Func | ||
* @param iterator Source iterator | ||
* @param <X> Type of item | ||
*/ | ||
private <X> MappedWithIndex( | ||
final AtomicInteger indexcounter, | ||
final BiFunc<? super X, Integer, ? extends Y> func, | ||
final Iterator<? extends X> iterator | ||
) { | ||
super( | ||
new Mapped<>( | ||
item -> func.apply(item, indexcounter.incrementAndGet()), | ||
iterator | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
047fb51
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puzzle
1449-0c19404b
discovered insrc/main/java/org/cactoos/io/package-info.java
and submitted as #1577. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.