This file contains hidden or 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
public class MutableArrayList<E> { | |
private int size; | |
private E[] elementData; | |
public E set(int index, E e) { | |
E oldValue = elementData[index]; | |
elementData[index] = e; | |
return oldValue; |
This file contains hidden or 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
public class Processor { | |
private final AuthorizationService3 authService; | |
private final Executor exec = Executors.newCachedThreadPool(); | |
public Either<Error,Vector<String>> processUsersFiles(User user, NonEmptyList<DataFileMetadata> files){ | |
return authService.isAuthorized(user, files) | |
.flatMap(this::loadContents); |
This file contains hidden or 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
@AllArgsConstructor | |
public class Processor { | |
public static enum Error { | |
NO_PERMISSIONS | |
} | |
private final AuthorizationService authService; | |
private final Executor exec = Executors.newCachedThreadPool(); | |
public Either<Error,Vector<String>> processUsersFiles(User user, NonEmptyList<DataFileMetadata> files){ |
This file contains hidden or 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
@AllArgsConstructor | |
@Getter | |
public abstract class DataFileMetadata { | |
public LazyEither<IOException,String> loadAsync(Executor ex){ | |
} | |
} |
This file contains hidden or 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
public class Processor { | |
public static enum Error { | |
NO_PERMISSIONS | |
} | |
private final AuthorizationService authService; | |
public Either<Error,Vector<String>> processUsersFiles(User user, NonEmptyList<DataFileMetadata> files){ | |
return authService.isAuthorized(user, files) | |
.map(this::loadContents); |
This file contains hidden or 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
@AllArgsConstructor | |
public class Processor { | |
private final AuthorizationService authService; | |
public Vector<String> processUsersFiles(User user, NonEmptyList<DataFileMetadata> files){ | |
if(authService.isAuthorized(user)){ | |
return files.map(DataFileMetadata::getContents) | |
.vector(); |
This file contains hidden or 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
public class NonLocking { | |
Executor ex = Executors.newCachedThreadPool(); | |
public ReactiveSeq<Result> processData(Map<Long,List<Data>> data) { | |
return new LazyReact(ex).fromIterable(data.entrySet()) | |
.flatMap(e -> this.process(e.getKey(), e.getValue())); |
This file contains hidden or 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
package com.nullex.nolocks.immutable; | |
import com.nullex.Data; | |
import cyclops.control.Future; | |
import cyclops.futurestream.FutureStream; | |
import cyclops.futurestream.LazyReact; | |
import cyclops.reactive.FluxReactiveSeq; | |
import cyclops.reactive.ReactiveSeq; | |
import cyclops.reactive.Spouts; | |
import lombok.Getter; |
This file contains hidden or 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
@AllArgsConstructor | |
@Getter | |
public abstract class DataFileMetadata { | |
private final long customerId; | |
private final String type; | |
private final Either<IOException,String> contents = LazyEither.lazy(this::loadContents); | |
protected abstract Either<IOException,String> loadContents(); |
This file contains hidden or 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
@AllArgsConstructor | |
@Getter | |
public abstract class DataFileMetadata { | |
private final long customerId; | |
private final String type; | |
private final Option<String> contents = Maybe.fromEval(Eval.later(this::loadContents)) | |
.concatMap(Function.identity()); | |
protected abstract Option<String> loadContents(); |
NewerOlder