File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/main/java/org/springframework/samples/petclinic/vet Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package org .springframework .samples .petclinic .vet ;
17
17
18
- import java .util .ArrayList ;
19
- import java .util .Collections ;
18
+ import java .util .Comparator ;
20
19
import java .util .HashSet ;
21
20
import java .util .List ;
22
21
import java .util .Set ;
22
+ import java .util .stream .Collectors ;
23
23
24
- import org .springframework .beans .support .MutableSortDefinition ;
25
- import org .springframework .beans .support .PropertyComparator ;
24
+ import org .springframework .samples .petclinic .model .NamedEntity ;
26
25
import org .springframework .samples .petclinic .model .Person ;
27
26
28
27
import jakarta .persistence .Entity ;
@@ -59,9 +58,9 @@ protected Set<Specialty> getSpecialtiesInternal() {
59
58
60
59
@ XmlElement
61
60
public List <Specialty > getSpecialties () {
62
- List < Specialty > sortedSpecs = new ArrayList <>( getSpecialtiesInternal ());
63
- PropertyComparator . sort ( sortedSpecs , new MutableSortDefinition ( "name" , true , true ));
64
- return Collections . unmodifiableList ( sortedSpecs );
61
+ return getSpecialtiesInternal (). stream ()
62
+ . sorted ( Comparator . comparing ( NamedEntity :: getName ))
63
+ . collect ( Collectors . toList () );
65
64
}
66
65
67
66
public int getNrOfSpecialties () {
You can’t perform that action at this time.
0 commit comments