boolean haveApps = apps.contains(query);
if (haveApps)
app.add("apps");
boolean haveBooks = books.contains(query);
if (haveBooks)
app.add("books");
boolean haveMusic = music.contains(query);
if (haveMusic)
app.add("music");
大家会如何优化上面的代码呢?
boolean haveApps = apps.contains(query);
if (haveApps)
app.add("apps");
boolean haveBooks = books.contains(query);
if (haveBooks)
app.add("books");
boolean haveMusic = music.contains(query);
if (haveMusic)
app.add("music");
大家会如何优化上面的代码呢?