Skip to content

Commit cdc91d3

Browse files
ngocnhan-tran1996mp911de
authored andcommitted
Polish diamond operator usage.
Closes #3620
1 parent 9d6676c commit cdc91d3

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

spring-data-envers/src/main/java/org/springframework/data/envers/repository/support/EnversRevisionRepositoryImpl.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
* @author Donghun Shin
6666
* @author Greg Turnquist
6767
* @author Aref Behboodi
68+
* @author Ngoc Nhan
6869
*/
6970
@Transactional(readOnly = true)
7071
public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N>>
@@ -117,7 +118,7 @@ public Optional<Revision<N, T>> findRevision(ID id, N revisionNumber) {
117118
Assert.notNull(id, "Identifier must not be null!");
118119
Assert.notNull(revisionNumber, "Revision number must not be null!");
119120

120-
List<Object[]> singleResult = (List<Object[]>) createBaseQuery(id) //
121+
List<Object[]> singleResult = createBaseQuery(id) //
121122
.add(AuditEntity.revisionNumber().eq(revisionNumber)) //
122123
.getResultList();
123124

spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/AbstractPersistable.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
* @author Thomas Darimont
3535
* @author Mark Paluch
3636
* @author Greg Turnquist
37+
* @author Ngoc Nhan
3738
* @param <PK> the type of the identifier.
3839
*/
3940
@MappedSuperclass
@@ -89,7 +90,7 @@ public boolean equals(Object obj) {
8990

9091
AbstractPersistable<?> that = (AbstractPersistable<?>) obj;
9192

92-
return null == this.getId() ? false : this.getId().equals(that.getId());
93+
return this.getId() != null && this.getId().equals(that.getId());
9394
}
9495

9596
@Override

spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
* @author Christoph Strobl
3838
* @author David Madden
3939
* @author Jens Schauder
40+
* @author Ngoc Nhan
4041
*/
4142
public class JpaSort extends Sort {
4243

@@ -281,14 +282,14 @@ public <A extends Attribute<S, U>, U> Path<S, U> dot(A attribute) {
281282
* @return
282283
*/
283284
public <P extends PluralAttribute<S, ?, U>, U> Path<S, U> dot(P attribute) {
284-
return new Path<S, U>(add(attribute));
285+
return new Path<>(add(attribute));
285286
}
286287

287288
private List<Attribute<?, ?>> add(Attribute<?, ?> attribute) {
288289

289290
Assert.notNull(attribute, "Attribute must not be null");
290291

291-
List<Attribute<?, ?>> newAttributes = new ArrayList<Attribute<?, ?>>(attributes.size() + 1);
292+
List<Attribute<?, ?>> newAttributes = new ArrayList<>(attributes.size() + 1);
292293
newAttributes.addAll(attributes);
293294
newAttributes.add(attribute);
294295
return newAttributes;

0 commit comments

Comments
 (0)