title: I'm always get -1 index in java arraylist
body: <pre><code>import java.util.*;
  
  
  public class SWDistaster extends ITDisaster
  {
      String Cause; int count=0;
      List&lt;String&gt; SW_NameList = new ArrayList&lt;String&gt;();
      List&lt;String&gt; SW_PlaceList = new ArrayList&lt;String&gt;();
      List&lt;Double&gt; SW_CostList = new ArrayList&lt;Double&gt;();
      List&lt;Integer&gt; SW_DateList = new ArrayList&lt;Integer&gt;();
  
      public SWDistaster() {}
      public SWDistaster(String Name)
      {
          super(Name);
      }
      public void show() 
      {
          System.out.println(Name + " " + Place + " " + Cost + " " + Date + " " + Cause);
  
      }
  
      public void SW_SearchName(String name)
      {
          System.out.println(SW_NameList.lastIndexOf(name));
          if(SW_NameList.contains(name)) 
          {
              System.out.println(SW_PlaceList.get(SW_NameList.indexOf(name)));
              System.out.println("here");
          } 
          else
          {
              SW_NameList(name);
              //System.out.println("here2");
          }
      }
      public void SW_NameList(String name)
      {
          SW_NameList.add(count, name);
          count++;
      }
      public void SW_PlaceList(String place)
      {
          SW_PlaceList.add(place);
      }
      public void SW_CostList(double cost)
      {
          SW_CostList.add(cost);
      }
      public void SW_DateList(int date)
      {
          SW_DateList.add(date);
      }
      public void ShowList()
      {
          for(int i = 0; i&lt;SW_NameList.size() ; i++) 
          {
              System.out.print((SW_NameList.get(i)).toString());
          }  
      }
  }
  </code></pre>
  
  <p>and application class :</p>
  
  <pre><code>public class Application {
      public static void main(String[] args) {
  
          SWDistaster dis1 = new SWDistaster();
          dis1.SW_SearchName("Election");
          dis1.ShowList();
          SWDistaster dis2 = new SWDistaster();
          dis2.SW_SearchName("Election");
          dis2.ShowList();
          SWDistaster dis3 = new SWDistaster();
          dis3.SW_SearchName("Batee5");
          dis3.ShowList();
      }
  }
  </code></pre>
  
  <p>there is no append in arraylist like i'm always used to do in vector in c++ !
  and i need to save all names in arraylist to come and search in and if i find it i would show the place and date and if not i will add it to the arraylist
  and may anybody also help me how to use files to save in it more easily as i'm new to java </p>