Skip to content

Commit 098661c

Browse files
committed
Replace with method references
1 parent 5febdaf commit 098661c

File tree

9 files changed

+22
-21
lines changed

9 files changed

+22
-21
lines changed

exist-core/src/main/java/org/exist/client/security/EditPropertiesDialog.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,25 +214,25 @@ private void initComponents() {
214214
lblSizeValue = new javax.swing.JLabel();
215215

216216
miInsertAceBefore.setText("Insert ACE before...");
217-
miInsertAceBefore.addActionListener(evt -> miInsertAceBeforeActionPerformed(evt));
217+
miInsertAceBefore.addActionListener(this::miInsertAceBeforeActionPerformed);
218218
pmAcl.add(miInsertAceBefore);
219219

220220
miInsertAceAfter.setText("Insert ACE after...");
221-
miInsertAceAfter.addActionListener(evt -> miInsertAceAfterActionPerformed(evt));
221+
miInsertAceAfter.addActionListener(this::miInsertAceAfterActionPerformed);
222222
pmAcl.add(miInsertAceAfter);
223223
pmAcl.add(jSeparator3);
224224

225225
miMoveUp.setText("Move ACE up");
226-
miMoveUp.addActionListener(evt -> miMoveUpActionPerformed(evt));
226+
miMoveUp.addActionListener(this::miMoveUpActionPerformed);
227227
pmAcl.add(miMoveUp);
228228

229229
miMoveDown.setText("Move ACE down");
230-
miMoveDown.addActionListener(evt -> miMoveDownActionPerformed(evt));
230+
miMoveDown.addActionListener(this::miMoveDownActionPerformed);
231231
pmAcl.add(miMoveDown);
232232
pmAcl.add(jSeparator4);
233233

234234
miRemoveAce.setText("Remove ACE");
235-
miRemoveAce.addActionListener(evt -> miRemoveAceActionPerformed(evt));
235+
miRemoveAce.addActionListener(this::miRemoveAceActionPerformed);
236236
pmAcl.add(miRemoveAce);
237237

238238
jTextArea1.setColumns(20);
@@ -267,10 +267,10 @@ private void initComponents() {
267267
lblGroupValue.setText("<group>");
268268

269269
btnChangeOwner.setText("...");
270-
btnChangeOwner.addActionListener(evt -> btnChangeOwnerActionPerformed(evt));
270+
btnChangeOwner.addActionListener(this::btnChangeOwnerActionPerformed);
271271

272272
btnChangeGroup.setText("...");
273-
btnChangeGroup.addActionListener(evt -> btnChangeGroupActionPerformed(evt));
273+
btnChangeGroup.addActionListener(this::btnChangeGroupActionPerformed);
274274

275275
tblBasePermissions.setModel(getBasicPermissionsTableModel());
276276
tblBasePermissions.setRowSelectionAllowed(false);
@@ -290,13 +290,13 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
290290
jScrollPane3.setViewportView(tblAcl);
291291

292292
btnSave.setText("Save");
293-
btnSave.addActionListener(evt -> btnSaveActionPerformed(evt));
293+
btnSave.addActionListener(this::btnSaveActionPerformed);
294294

295295
btnClose.setText("Close");
296-
btnClose.addActionListener(evt -> btnCloseActionPerformed(evt));
296+
btnClose.addActionListener(this::btnCloseActionPerformed);
297297

298298
btnAddAce.setText("Add Access Control Entry...");
299-
btnAddAce.addActionListener(evt -> btnAddAceActionPerformed(evt));
299+
btnAddAce.addActionListener(this::btnAddAceActionPerformed);
300300

301301
lblDigest.setText("Digest:");
302302

exist-core/src/main/java/org/exist/storage/BrokerPool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ private void _initialize() throws EXistException, DatabaseConfigurationException
495495
this.notificationService = servicesManager.register(new NotificationService());
496496

497497
this.journalManager = recoveryEnabled ? Optional.of(new JournalManager()) : Optional.empty();
498-
journalManager.ifPresent(manager -> servicesManager.register(manager));
498+
journalManager.ifPresent(servicesManager::register);
499499

500500
final SystemTaskManager systemTaskManager = servicesManager.register(new SystemTaskManager(this));
501501
this.transactionManager = servicesManager.register(new TransactionManager(this, journalManager, systemTaskManager));
@@ -505,7 +505,7 @@ private void _initialize() throws EXistException, DatabaseConfigurationException
505505
this.symbols = servicesManager.register(new SymbolTable());
506506

507507
this.expathRepo = Optional.ofNullable(new ExistRepository());
508-
expathRepo.ifPresent(existRepository -> servicesManager.register(existRepository));
508+
expathRepo.ifPresent(servicesManager::register);
509509
servicesManager.register(new ClasspathHelper());
510510

511511
this.indexManager = servicesManager.register(new IndexManager(this));

exist-core/src/main/java/org/exist/xmldb/LocalXMLResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ public Object intercept(final Object obj, final Method method, final Object[] ar
355355
@Override
356356
public Node item(final int index) {
357357
return Optional.ofNullable(underlying.item(index))
358-
.map(n -> exportInternalNode(n))
358+
.map(LocalXMLResource.this::exportInternalNode)
359359
.orElse(null);
360360
}
361361

exist-core/src/main/java/org/exist/xquery/VariableDeclaration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void dump(final ExpressionDumper dumper) {
217217

218218
@Override
219219
public int returnsType() {
220-
return expression.map(value -> value.returnsType()).orElse(Type.ITEM);
220+
return expression.map(Expression::returnsType).orElse(Type.ITEM);
221221
}
222222

223223
@Override

exist-core/src/main/java/org/exist/xquery/functions/session/GetID.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.exist.xquery.value.Type;
3131

3232
import javax.annotation.Nonnull;
33+
import java.util.Objects;
3334

3435
/**
3536
* Returns the ID of the current session or an empty sequence
@@ -54,7 +55,7 @@ public GetID(XQueryContext context) {
5455
public Sequence eval(final Sequence[] args, @Nonnull final SessionWrapper session) throws XPathException {
5556

5657
return withValidSession(session, SessionWrapper::getId)
57-
.filter(id -> id != null)
58+
.filter(Objects::nonNull)
5859
.map(id -> (Sequence)new StringValue(id))
5960
.orElse(Sequence.EMPTY_SEQUENCE);
6061
}

exist-start/src/main/java/org/exist/start/Classpath.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ public EXistClassLoader getClassLoader(ClassLoader parent) {
134134
} catch(final MalformedURLException e) {
135135
return Optional.<URL>empty();
136136
}
137-
}).filter(ou -> ou.isPresent())
137+
}).filter(Optional::isPresent)
138138
.map(Optional::get)
139-
.toArray(sz -> new URL[sz]);
139+
.toArray(URL[]::new);
140140

141141
// try and ensure we have a classloader
142142
parent = or(

extensions/exquery/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/RestXqServiceRegistryPersistence.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public void loadRegistry() {
8888

8989
//only load the registry if a serialized registry exists on disk
9090
getRegistryFile(false)
91-
.filter(r -> Files.exists(r))
92-
.filter(r -> Files.isRegularFile(r))
91+
.filter(Files::exists)
92+
.filter(Files::isRegularFile)
9393
.ifPresent(this::loadRegistry);
9494
}
9595

extensions/indexes/lucene/src/main/java/org/exist/indexing/lucene/LuceneIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public void remove() throws DBException {
181181
close();
182182
Path dir = getDataDir().resolve(getDirName());
183183
try {
184-
Files.list(dir).forEach(path -> FileUtils.deleteQuietly(path));
184+
Files.list(dir).forEach(FileUtils::deleteQuietly);
185185
} catch (Exception e) {
186186
// never abort at this point, so recovery can continue
187187
LOG.warn(e.getMessage(), e);

extensions/indexes/lucene/src/main/java/org/exist/xquery/modules/lucene/QueryOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public void configureParser(CommonQueryParserConfiguration parser) {
252252
}
253253
if (allowLeadingWildcard)
254254
parser.setAllowLeadingWildcard(true);
255-
phraseSlop.ifPresent(integer -> parser.setPhraseSlop(integer));
255+
phraseSlop.ifPresent(parser::setPhraseSlop);
256256
if (filterRewrite)
257257
parser.setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
258258
else

0 commit comments

Comments
 (0)