Class CollectionToOptional
java.lang.Object
eu.solven.cleanthat.engine.java.refactorer.AJavaparserMutator
eu.solven.cleanthat.engine.java.refactorer.AJavaparserExprMutator
eu.solven.cleanthat.engine.java.refactorer.mutators.CollectionToOptional
- All Implemented Interfaces:
IJavaparserMutator
,IMutator
,IMutatorExternalReferences
,IWalkingMutator<com.github.javaparser.ast.Node,
com.github.javaparser.ast.Node>
Turns `list.isEmpty() ? Optional.empty() : Optional.of(list.get(0))` into `list.stream().findFirst()`
- Author:
- Benoit Lacelle
-
Field Summary
Fields inherited from interface eu.solven.cleanthat.engine.java.refactorer.meta.IMutator
ID_NOOP, IS_PRODUCTION_READY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
processNotRecursively
(com.github.javaparser.ast.expr.Expression expr) Methods inherited from class eu.solven.cleanthat.engine.java.refactorer.AJavaparserExprMutator
processNotRecursively, replaceExpression
Methods inherited from class eu.solven.cleanthat.engine.java.refactorer.AJavaparserMutator
cancelDueToComment, getSimpleName, getWarnCount, isAssignableBy, isAssignableBy, isImportable, isImported, messageForIssueReporting, nameOrQualifiedName, onMethodName, optResolved, optResolvedType, optResolvedType, replaceBy, replaceNode, scopeHasRequiredType, scopeHasRequiredType, tryRemove, tryReplace, typeHasRequiredType, walkAst
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.solven.cleanthat.engine.java.refactorer.meta.IMutator
getId, getIds, isDraft, isJreOnly, minimalJavaVersion
Methods inherited from interface eu.solven.cleanthat.engine.java.refactorer.meta.IMutatorExternalReferences
checkstyleUrl, errorProneUrl, getCheckstyleId, getErrorProneId, getJSparrowId, getPmdId, getPmdIds, getSeeUrls, getSonarId, jSparrowUrl, pmdUrl, sonarUrl
Methods inherited from interface eu.solven.cleanthat.engine.java.refactorer.meta.IWalkingMutator
walkAstHasChanged
-
Constructor Details
-
CollectionToOptional
public CollectionToOptional()
-
-
Method Details
-
getCleanthatId
-
processNotRecursively
protected boolean processNotRecursively(com.github.javaparser.ast.expr.Expression expr) - Overrides:
processNotRecursively
in classAJavaparserExprMutator
-