Mon.invert renamed to swap

This commit is contained in:
Paul Campbell 2018-07-21 23:23:02 +01:00
parent 3789afb824
commit c75204c676
2 changed files with 2 additions and 2 deletions

View file

@ -85,7 +85,7 @@ class GitDBRepo {
) { ) {
final GitTreeReader treeFilter = new GitTreeReader(repository).treeFilter(key); final GitTreeReader treeFilter = new GitTreeReader(repository).treeFilter(key);
return streamTree(branchRef, treeFilter).flatMap(s -> return streamTree(branchRef, treeFilter).flatMap(s ->
Result.invert(s.findFirst() Result.swap(s.findFirst()
.map(NamedRevBlob::blobAsString) .map(NamedRevBlob::blobAsString)
.map(Maybe::just) .map(Maybe::just)
.orElseGet(Maybe::nothing))); .orElseGet(Maybe::nothing)));

View file

@ -114,7 +114,7 @@ final class LocalGitDBImpl implements GitDB, LocalGitDB {
public Result<Maybe<GitDBBranch>> branch(final String name) { public Result<Maybe<GitDBBranch>> branch(final String name) {
return Result.flatMapMaybe( return Result.flatMapMaybe(
Result.of(() -> Maybe.maybe(repository.findRef(name))), Result.of(() -> Maybe.maybe(repository.findRef(name))),
refMaybe -> Result.invert(refMaybe.map(branchInit))); refMaybe -> Result.swap(refMaybe.map(branchInit)));
} }
} }