Цитата:
Сообщение от Aquanox
Что-же он делает в конструкторе что скорость создания объектов возрастает. Байткод не смотрели? (удобный diff байткода можно смотреть с помощью ASM плагина под IDEA)
|
Ничего необычного. Скомпилированный код DataLombook:
Код:
package model;
import java.beans.ConstructorProperties;
public class DataLombook
{
private final String name;
private final String secondName;
private final int age;
@ConstructorProperties({"name", "secondName", "age"})
public DataLombook(String name, String secondName, int age)
{
this.name = name;
this.secondName = secondName;
this.age = age;
}
public String getName()
{
return this.name;
}
public String getSecondName()
{
return this.secondName;
}
public int getAge()
{
return this.age;
}
public boolean equals(Object o)
{
if (o == this)
return true;
if (!(o instanceof DataLombook))
return false;
DataLombook other = (DataLombook)o;
if (!other.canEqual(this))
return false;
Object this$name = getName();
Object other$name = other.getName();
if (this$name == null ? other$name != null : !this$name.equals(other$name))
return false;
Object this$secondName = getSecondName();
Object other$secondName = other.getSecondName();
if (this$secondName == null ? other$secondName != null : !this$secondName.equals(other$secondName))
return false;
return getAge() == other.getAge();
}
public boolean canEqual(Object other)
{
return other instanceof DataLombook;
}
public int hashCode()
{
int PRIME = 31;
int result = 1;
Object $name = getName();
result = result * 31 + ($name == null ? 0 : $name.hashCode());
Object $secondName = getSecondName();
result = result * 31 + ($secondName == null ? 0 : $secondName.hashCode());
result = result * 31 + getAge();
return result;
}
public String toString()
{
return "DataLombook(name=" + getName() + ", secondName=" + getSecondName() + ", age=" + getAge() + ")";
}
}