Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class FlightDatabase {
- ArrayList<Flight> flights = new ArrayList<Flight> ();
- public FlightDatabase ( ) {
- this.flights.add ( new Flight ( "Wroclaw", "Berlin" ) );
- this.flights.add ( new Flight ( "Warsaw", "Poznan" ) );
- this.flights.add ( new Flight ( "Krakow", "Vienna" ) );
- this.flights.add ( new Flight ( "Wroclaw", "Rotterdam" ) );
- this.flights.add ( new Flight ( "Warsaw", "Moscow" ) );
- this.flights.add ( new Flight ( "Wroclaw", "Frankfurt" ) );
- this.flights.add ( new Flight ( "Warsaw", "London" ) );
- this.flights.add ( new Flight ( "Krakow", "Paris" ) );
- }
- public void checkIfFlightExists ( ) {
- for (int i = 0; i < this.flights.size (); i++) {
- Flight connection = flights.get ( i );
- if (this.flights.equals ( connection ){
- System.out.println ("There is such connection");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement