Changed method query(String keyword) to use a more efficient way for mapping the ArrayList to an Array