public static QueryResult search(Collection<BusStop> locations, Location departure, Location destination)
	{
		PriorityQueue<DistanceCompare> sortedList1 = new PriorityQueue<DistanceCompare>(locations.size ());
		for(BusStop b2: locations)
			sortedList1.offer(new DistanceCompare(departure, b2));
		PriorityQueue<DistanceCompare> sortedList2 = new PriorityQueue<DistanceCompare> (locations.size ());
		for (BusStop b3: locations) 
			sortedList2.offer(new DistanceCompare(destination, b3));
		BusStop closestDestination = sortedList2.poll().bs;
		for (int i = 0; i < lines1.size (); i ++) {
			Line l = lines1.get(i);
			for (int j = 0; j < l.route.size (); j ++) {
				if (l.route.get(j).getName ().equals(closestDestination.getName ())) {
					while (sortedList1.peek() != null) {
						BusStop closestDeparture = sortedList1.poll().bs;
						for (int k = 0; k < l.route.size (); k ++) {
							if (l.route.get(k).getName().equals(closestDeparture.getName ())) {
								q = new QueryResult(l, closestDeparture, closestDestination);
								return q;
							}
						}
					}
				}
			}
		}
		return null;
	}