@@ -190,20 +190,24 @@ public void forEachUiState(UiStatesLooper.Modifiable.Looper uiStatesLooper){
190
190
*/
191
191
public String [] search (String [] searchList , String [] searchKeyWords , ActionInjector injector ) throws Exception {
192
192
synchronized (this ) {
193
- final String [] resultList = new String [searchList . length ] ;
193
+ final String [][] resultList = { new String [0 ]} ;
194
194
return Executors .callable (() -> {
195
195
for (int pos = 0 ; pos < searchList .length ; pos ++) {
196
196
for (String keyword : searchKeyWords ) {
197
197
if (searchList [pos ].replaceAll (" " ,"" ).trim ().toLowerCase ().contains (keyword .replaceAll (" " ,"" ).trim ().toLowerCase ())) {
198
- resultList [pos ] = searchList [pos ];
198
+ //dynamic array conception
199
+ if (pos > resultList [0 ].length ){
200
+ resultList [0 ] = Arrays .copyOf (resultList [0 ], resultList [0 ].length +1 );
201
+ }
202
+ resultList [0 ][pos ] = searchList [pos ];
199
203
if (injector != null ){
200
204
injector .execute (getChildUiStateByIndex (pos ), pos );
201
205
}
202
206
break ;
203
207
}
204
208
}
205
209
}
206
- }, resultList ).call ();
210
+ }, resultList [ 0 ] ).call ();
207
211
}
208
212
}
209
213
@@ -237,7 +241,7 @@ public void revertSearchEngine(@Nullable ActionInjector actionInjector) throws E
237
241
public String [] sort (String [] list , int sortAlgorithm ) throws Exception {
238
242
synchronized (this ) {
239
243
//to apply the sort change as an external final change on a list copy (warning : ->Internal List change(positions or items count or items values) = Malicious Activity
240
- final String [] copy = list ;
244
+ final String [] copy = Arrays . copyOf ( list , list . length ) ;
241
245
return Executors .callable (() -> {
242
246
String tempPointer = "" ;
243
247
//main String List looping
0 commit comments