File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
api/src/main/java/io/kafbat/ui/service/index Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,23 @@ public List<T> find(String search) {
3838 return find (search , true );
3939 }
4040
41+ private List <T > list (Stream <T > stream , boolean sort ) {
42+ if (sort ) {
43+ return stream .sorted ().toList ();
44+ } else {
45+ return stream .toList ();
46+ }
47+ }
48+
4149 public List <T > find (String search , boolean sort ) {
4250 if (search == null || search .isBlank ()) {
43- return this .getItems ().stream ().map (Tuple2 ::getT2 ). toList ( );
51+ return list ( this .getItems ().stream ().map (Tuple2 ::getT2 ), sort );
4452 }
4553 if (!enabled ) {
46- Stream < T > stream = this .getItems ()
54+ return list ( this .getItems ()
4755 .stream ()
4856 .filter (t -> t .getT1 ().stream ().anyMatch (s -> CI .contains (s , search )))
49- .map (Tuple2 ::getT2 );
50- if (sort ) {
51- return stream .sorted ().toList ();
52- } else {
53- return stream .toList ();
54- }
57+ .map (Tuple2 ::getT2 ), sort );
5558 }
5659 try {
5760 List <SearchResult <T >> result = new ArrayList <>();
You can’t perform that action at this time.
0 commit comments