Last active
December 15, 2015 19:03
-
-
Save HDBandit/704485f4a7f9b1792dec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// business logic | |
public static List<Car> filterCarsByBrand(List<Car> cars, String brand) { | |
ArrayList<Car> filteredCars = new ArrayList<Car>(); | |
for (Car car : cars) { | |
if (brand.equals(car.getBrand())) { | |
filteredCars.add(car); | |
} | |
} | |
return filteredCars; | |
} | |
... | |
// from your programm, you can call it from this way | |
List<Car> filteredCars = filterCarsByBrand(cars, "Ferrari"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment