Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a3c6ee0
Redundant condition: "(o == null || !(o instanceof X))" is always th…
Jan 27, 2022
ca7beac
Updated dependency ?
Jan 27, 2022
df54488
Redundant condition: "(o == null || !(o instanceof X))" is always th…
Jan 27, 2022
49bafa3
Replace loop with Arrays.fill
Jan 27, 2022
e227a94
Use Math.min/max
Jan 27, 2022
8cd75af
Replace duplicate code.
Jan 27, 2022
9dd0c6a
Replace duplicate code.
Jan 27, 2022
2bc79d7
Redundant null check, can never be NULL. Error?
Jan 27, 2022
1dca191
Optional API
Jan 27, 2022
c1934e8
Redundant explicit array creation.
Jan 27, 2022
f3eaf59
Unnecessary String.length()
Jan 27, 2022
7357a84
Redundant cast removed.
Jan 27, 2022
9f67cf9
Simplified stream usage.
Jan 27, 2022
dbe682c
Use String instead
Jan 27, 2022
72157ed
Improved type declaration avoids class casts.
Jan 27, 2022
0659287
Use empty <> instead.
Jan 27, 2022
db489c3
Collapse catch blocks.
Jan 27, 2022
3bfed20
Use modern try with resource management
Jan 27, 2022
e42243c
Replace with lambda.
Jan 27, 2022
2ca93b1
Use List.sort(...)
Jan 27, 2022
7f8e26a
Use Comparator.comparing
Jan 27, 2022
3342a8c
Replace lambda with method reference (better readability)
Jan 27, 2022
cd4b7de
Replace lambda with method reference (better readability)
Jan 27, 2022
2b52cad
Use modern Map api.
Jan 27, 2022
dcf0340
Use expression lambda.
Jan 27, 2022
e54888f
Use enhanced for loop
Jan 27, 2022
48bbe80
Remove unnecessary boxing.
Jan 27, 2022
8162b8e
Remove unnecessary unboxing.
Jan 27, 2022
7c9b7ac
USe contains(...)
Jan 27, 2022
bf6ecec
Use modern, enhanced for-loop.
Jan 27, 2022
acb0f9b
Inner class can be static
Jan 27, 2022
696a0bf
Use parametrized constructor.
Jan 27, 2022
5e0e1fe
Use System.arraycopy
Jan 27, 2022
6699e15
Use Collections.addAll
Jan 27, 2022
d85d84e
Replace unpredictable constructor call
Jan 27, 2022
590b02f
Fixed compile error
Jan 27, 2022
67cd45e
Undo 'redundant cast removed'
Jan 27, 2022
c40f373
Fixed compile error.
Jan 27, 2022
cbf2864
Fixed compile error.
Jan 27, 2022
651976b
Undo 'Redundant cast removed'.
Jan 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,8 @@ public DatabaseFactory setSecurity(final SecurityManager security) {
* Test only API
*/
public void registerCallback(final DatabaseInternal.CALLBACK_EVENT event, Callable<Void> callback) {
List<Callable<Void>> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ArrayList<>();
this.callbacks.put(event, callbacks);
}
callbacks.add(callback);
List<Callable<Void>> callbacks = this.callbacks.computeIfAbsent(event, k -> new ArrayList<>());
callbacks.add(callback);
}

public static Database getActiveDatabaseInstance(final String databasePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private Object apply(Expression expression, Map<String, Object> input, CommandCo
for (NestedProjectionItem item : includeItems) {
String alias = item.alias != null ? item.alias.getStringValue() : item.expression.getDefaultAlias().getStringValue();
ResultInternal elem = new ResultInternal();
input.entrySet().forEach(x -> elem.setProperty(x.getKey(), x.getValue()));
input.forEach((key, value1) -> elem.setProperty(key, value1));
Object value = item.expression.execute(elem, ctx);
if (item.expansion != null) {
value = item.expand(expression, alias, value, ctx, recursion - 1);
Expand Down
8 changes: 2 additions & 6 deletions engine/src/main/java/com/arcadedb/schema/DocumentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,8 @@ public int hashCode() {
protected void addIndexInternal(final IndexInternal index, final int bucketId, final String[] propertyNames) {
index.setMetadata(name, propertyNames, bucketId);

List<IndexInternal> list = bucketIndexesByBucket.get(bucketId);
if (list == null) {
list = new ArrayList<>();
bucketIndexesByBucket.put(bucketId, list);
}
list.add(index);
List<IndexInternal> list = bucketIndexesByBucket.computeIfAbsent(bucketId, k -> new ArrayList<>());
list.add(index);

final List<String> propertyList = Arrays.asList(propertyNames);

Expand Down
8 changes: 2 additions & 6 deletions engine/src/main/java/com/arcadedb/utility/TableFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,8 @@ public void setColumnAlignment(final String column, final ALIGNMENT alignment) {
}

public void setColumnMetadata(final String columnName, final String metadataName, final String metadataValue) {
Map<String, String> metadata = columnMetadata.get(columnName);
if (metadata == null) {
metadata = new LinkedHashMap<String, String>();
columnMetadata.put(columnName, metadata);
}
metadata.put(metadataName, metadataValue);
Map<String, String> metadata = columnMetadata.computeIfAbsent(columnName, k -> new LinkedHashMap<String, String>());
metadata.put(metadataName, metadataValue);
}

public int getMaxWidthSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,7 @@ public void run() {
final Map<Integer, Integer> result = new HashMap<>();
database.scanType(TYPE_NAME, true, record -> {
final int id = (int) record.get("id");
Integer key = result.get(id);
if (key == null)
result.put(id, 1);
else
result.put(id, key + 1);
result.merge(id, 1, Integer::sum);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't even know the existence of merge :-)

return true;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,7 @@ public void run() {
final Map<Integer, Integer> result = new HashMap<>();
database.scanType(TYPE_NAME, true, record -> {
final int id = (int) record.get("id");
Integer key = result.get(id);
if (key == null)
result.put(id, 1);
else
result.put(id, key + 1);
result.merge(id, 1, Integer::sum);
return true;
});

Expand Down