forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eugenp#8919 from eugenp/BAEL-3461-v2
move nullaway article
- Loading branch information
Showing
6 changed files
with
123 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...om/baeldung/nullaway/NullAwayExample.java → ...om/baeldung/nullaway/NullAwayExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
package com.baeldung.nullaway; | ||
|
||
import com.baeldung.distinct.Person; | ||
|
||
public class NullAwayExample { | ||
|
||
/* | ||
|
65 changes: 65 additions & 0 deletions
65
libraries-3/src/main/java/com/baeldung/nullaway/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.baeldung.nullaway; | ||
|
||
public class Person { | ||
int age; | ||
String name; | ||
String email; | ||
|
||
public Person(int age, String name, String email) { | ||
super(); | ||
this.age = age; | ||
this.name = name; | ||
this.email = email; | ||
} | ||
|
||
public int getAge() { | ||
return age; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("Person [age="); | ||
builder.append(age); | ||
builder.append(", name="); | ||
builder.append(name); | ||
builder.append(", email="); | ||
builder.append(email); | ||
builder.append("]"); | ||
return builder.toString(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((email == null) ? 0 : email.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
Person other = (Person) obj; | ||
if (email == null) { | ||
if (other.email != null) | ||
return false; | ||
} else if (!email.equals(other.email)) | ||
return false; | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters