Skip to content

Instantly share code, notes, and snippets.

@Goldmensch
Last active January 8, 2023 18:53
Show Gist options
  • Select an option

  • Save Goldmensch/57ff9450405740b4848981bfc7deca47 to your computer and use it in GitHub Desktop.

Select an option

Save Goldmensch/57ff9450405740b4848981bfc7deca47 to your computer and use it in GitHub Desktop.
Java IntelliJ Codestyle builder names generator
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
class GenMan {
public static void main(String... args) {
System.out.print(
Stream.of(Stream.class, IntStream.class, DoubleStream.class, LongStream.class,
IntStream.Builder.class, RepositoryBuilder.class)
.flatMap(aClass -> Arrays.stream(aClass.getMethods())
.filter(method -> !Modifier.isStatic(method.getModifiers()) && Modifier.isPublic(method.getModifiers()))
.map(Method::getName))
.distinct()
.collect(Collectors.joining(", ")));
System.out.print(", ");
System.out.print(Stream.of("") // extra stuff
.collect(Collectors.joining(", ")));
}
}
Classes: Stream, IntStream, DoubleStream, LongStream, IntStream
Extra:
min, max, toArray, map, collect, toList, count, limit, filter, anyMatch, flatMap, forEach, findAny, skip, peek, reduce, distinct, findFirst, allMatch, sorted, forEachOrdered, mapToInt, mapToLong, mapToDouble, mapMulti, takeWhile, dropWhile, noneMatch, flatMapToInt, flatMapToDouble, flatMapToLong, mapMultiToInt, mapMultiToLong, mapMultiToDouble, iterator, spliterator, close, parallel, onClose, sequential, isParallel, unordered, sum, mapToObj, boxed, asLongStream, asDoubleStream, average, summaryStatistics, add, accept, build, andThen,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment