Skip to content

Commit

Permalink
Just use var to clean these up
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed May 25, 2024
1 parent 28a35fd commit 544330c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,10 @@ protected boolean hasInstanceVariables() {
*/
@Override
public List<Variable<Object>> getVariableList() {
Map<String, VariableAccessor> ivarAccessors = metaClass.getVariableAccessorsForRead();
ArrayList<Variable<Object>> list = new ArrayList<>(ivarAccessors.size());
for (Map.Entry<String, VariableAccessor> entry : ivarAccessors.entrySet()) {
Object value = entry.getValue().get(this);
var ivarAccessors = metaClass.getVariableAccessorsForRead();
var list = new ArrayList<Variable<Object>>(ivarAccessors.size());
for (var entry : ivarAccessors.entrySet()) {
var value = entry.getValue().get(this);
if (value == null) continue;
list.add(new VariableEntry<>(entry.getKey(), value));
}
Expand All @@ -1363,10 +1363,10 @@ public List<Variable<Object>> getVariableList() {
* @see IRubyObject#getMarshalVariableList()
*/
public List<Variable<Object>> getMarshalVariableList() {
Map<String, VariableAccessor> ivarAccessors = metaClass.getVariableAccessorsForRead();
ArrayList<Variable<Object>> list = new ArrayList<>(ivarAccessors.size());
var ivarAccessors = metaClass.getVariableAccessorsForRead();
var list = new ArrayList<Variable<Object>>(ivarAccessors.size());
for (Map.Entry<String, VariableAccessor> entry : ivarAccessors.entrySet()) {
Object value = entry.getValue().get(this);
var value = entry.getValue().get(this);
if (value == null || !(value instanceof Serializable)) continue;
list.add(new VariableEntry<>(entry.getKey(), value));
}
Expand All @@ -1378,10 +1378,10 @@ public List<Variable<Object>> getMarshalVariableList() {
*/
@Override
public List<String> getVariableNameList() {
Map<String, VariableAccessor> ivarAccessors = metaClass.getVariableAccessorsForRead();
ArrayList<String> list = new ArrayList<>(ivarAccessors.size());
for (Map.Entry<String, VariableAccessor> entry : ivarAccessors.entrySet()) {
Object value = entry.getValue().get(this);
var ivarAccessors = metaClass.getVariableAccessorsForRead();
var list = new ArrayList<String>(ivarAccessors.size());
for (var entry : ivarAccessors.entrySet()) {
var value = entry.getValue().get(this);
if (value == null) continue;
list.add(entry.getKey());
}
Expand Down

0 comments on commit 544330c

Please sign in to comment.