在Java中搜索ArrayList时如何忽略大小写?

I'm having trouble making the search in my ArrayList non-case sensitive. I have tried using toLowerCase() but I need the names to maintain their current format. I have also tried equalsIgnoreCase() but can't get it to work, though I may be doing something wrong there. Do you all have any tips on the best way to go about this?

这是我主要方法的相关部分:

      // Sequential search the String array and print the result
      reply = JOptionPane.YES_OPTION;
        
      while (reply == JOptionPane.YES_OPTION) 
      {            
         count = 0;
         output = "";
         input = JOptionPane.showInputDialog(null, 
                  "What team would you like to look up?");
            
         if ((input != null) && (input.length() > 0)) 
         {                
            boolean found = sequentialSearch(data, input);
                
            if (found == true) 
            {                   
               JOptionPane.showMessageDialog(null, output);            
            } 
            
            else 
            {              
               JOptionPane.showMessageDialog(null, "Sorry, I can't find that team in the list.");                
            }         
         }
           
         reply = JOptionPane.showConfirmDialog(null,
               "Do you want to search for another team?",
               "Do you want to search for another team?",
               JOptionPane.YES_NO_OPTION);
               
         totalTeams +=count;                       
      }
        
      System.exit(0);
   }
    
}

这是我的搜索方法:

   public static boolean sequentialSearch(ArrayList<String> array, String name) 
   {        
      final int STARTYEAR = 1903;
      int year;
      boolean found = false;
      
      for (int index = 0; index < array.size(); index++) 
      {           
         if (array.get(index).compareTo(name) == 0) 
         {          
            count ++;
            year = STARTYEAR + index;
            
            if ((year >= 1904) && (year < 1993))
            {               
               year = year + 1;           
            }
            
            else if (year >= 1993)
            {            
               year = year + 2;               
            }
               
            output = output + Integer.toString(year) + "\n"; 
                            
            found = true;                           
         }
      }
        
      output = "The " + input + " have won the World Series in the years:\n" +
               output + "They have won the World Series " + count + " times.";
      
      return found;
   }