可优化的代码段

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");

大家会如何优化上面的代码呢?

posted on 2012-03-13 12:47  亭子  阅读(210)  评论(0编辑  收藏  举报

导航