Q:

How to delete three element from a list?

i have completed my java app and i have problems, not all function work
So, the app must let me to ADD new cities with latitude and longitude, can eliminate city if i want (here i have the problem, i can't delete them) from search. and last, calculate distances from cities and make a total. So here is my code...
main
package ex1;

import java.util.*;
import java.math.*;
import java.io.*;

public class Itinerariu {

    public static List<Oras> drum = new ArrayList<Oras>();

    public static void main(String[] args) 
    {
        Scanner tastatura = new Scanner(System.in);
        int a;

        Oras drum = new Oras();

        do{
            System.out.println("Meniu");
            System.out.println("----------");
            System.out.println("1-Adaugarea oras");
            System.out.println("2-Stergerea unui oras");
            System.out.println("3-Distanta totala");
            System.out.println("4-Distanta dintre doua orase alaturate");

            a=tastatura.nextInt();

            switch(a)
            {
            case 1: System.out.println("\nAdaugati orasul\n");
                adaugareOras();
                break;

            case 2: System.out.println("\nStergeti orasul\n");
                stergereOras();
                break;

            case 3:// lungimeOras();
                System.out.println("\n");
                break;

            case 4: System.out.println("\nLungimea dintre doua orase alaturate\n");
                /*try{
                    salvareFisier();
                }catch (Exception e){
                    System.out.println("Eroare");
                }*/

                break;

            default: a=0;
            }
        }
        while(a!=0);
    }

    /*private static void salvareFisier() 
    {
        for(int i = 0; i<drum.size()-1; i++){
            for(int j = 0; i<drum.size(); j++){
                if(drum.get(i).getPozitie() > drum.get(j).getPozitie()){
                    Oras aux = drum.get(i);
                    drum.add(i, drum.get(j));
                    drum.add(j, aux);
                }
            }
        }
        try {
            FileOutputStream fOut = new FileOutputStream("distante.txt");
            PrintStream ps = new PrintStream(fOut);

            for(int i = 0; i <drum.size()-1; i++){
                ps.println("d(" + drum.get(i).getNume()+","+drum.get(i+1).getNume()+")="+distOras(drum.get(i), drum.get(i+1)));
            }
            ps.close();
            fOut.close();
        } catch(IOException ex){
            System.out.println("Nu s-a putut crea fisierul");
            System.exit(1);
        }

    }

    private static double lungimeOras() 
    {
        for(int i = 0; i < drum.size() - 1 ; i++)
            for(int j = 0; j< drum.size() ; j++)
                if(drum.get(i).getPozitie() > drum.get(j).getPozitie()){
                    Oras aux = drum.get(i);
                    drum.add(i, drum.get(j));
                    drum.add(j, aux);
                }
        double l = 0;
        for(int i = 0; i < drum.size() - 1; i++){
            l += distOras(drum.get(i), drum.get(i+1));
        }
        return l;

    }

    private static double distOras(Oras oras, Oras oras2) 
    {
        double distanta, long1, long2, lat1, lat2;

        long1=oras.getLongitudine()*79;
        long2=oras2.getLongitudine()*79;
        lat1=oras.getLatitudine()*111;
        lat2=oras2.getLatitudine()*111;

        distanta = Math.sqrt((long1-long2)*(long1-long2)+(lat1-lat2)*(lat1-lat2));

        return distanta;
    }
*/
    private static void stergereOras() 
    {
        Scanner tastatura = new Scanner(System.in);
        String name;

        System.out.println("Introduceti numele orasului care doriti sa fie sters");
        name = tastatura.next();

        for(int i = 0 ; i <= drum.size() ; i++){
            if(drum.get(i).getNume() == name){
                drum.remove(name);}}

        for(Oras o:drum)
            System.out.println(o.getNume());
    }

    private static void adaugareOras() 
    {
        Scanner tastatura = new Scanner(System.in);
        Oras x = new Oras();

        int l;

        int index;
        String n;
        double lat;
        double lon;

        System.out.println("Introduceti pozitia orasului in itinerariu");
        index = tastatura.nextInt();
        x.setPozitie(index);

        System.out.println("Introduceti numele orasului:");
        n = tastatura.next();
        x.setNume(n);

        System.out.println("Introduceti latitudinea:");
        lat = tastatura.nextInt();
        x.setLatitudine(lat);

        System.out.println("Introduceti longitudinea:");
        lon = tastatura.nextInt();
        x.setLongitudine(lon);

        drum.add(x);

        System.out.println("----------");

        System.out.println("1-Introducerea urmatorului oras");
        System.out.println("2-Revenire la meniul principal");

        l = tastatura.nextInt();
        switch(l){
        case 1:
            adaugareOras();
            break;
        default:
            break;
        }

    }

}

And here is second code.
package ex1;

public class Oras {
    public int pozitie;
    public String nume;
    public double latitudine;
    public double longitudine;

    public int getPozitie() {
        return pozitie;
    }

    public void setPozitie(int pozitie) {
        this.pozitie = pozitie;
    }

    public String getNume() {
        return nume;
    }

    public void setNume(String nume) {
        this.nume = nume;
    }

    public double getLatitudine() {
        return latitudine;
    }

    public void setLatitudine(double latitudine) {
        this.latitudine = latitudine;
    }

    public double getLongitudine() {
        return longitudine;
    }

    public void setLongitudine(double longitudine) {
        this.longitudine = longitudine;
    }

}

Here is the problem with delete city: 
   private static void stergereOras() 
    {
        Scanner tastatura = new Scanner(System.in);
        String name;

        System.out.println("Introduceti numele orasului care doriti sa fie sters");
        name = tastatura.next();

        for(int i = 0 ; i <= drum.size() ; i++){
            if(drum.get(i).getNume() == name){
                drum.remove(name);}}

        for(Oras o:drum)
            System.out.println(o.getNume());
    }

A:

solved ! with if(drum.get(i).getNume().equals(name) ThankS !!

