code: public static boolean isAlgorithlIdentifierEqual(AlgorithmIdentifier id1, AlgorithmIdentifier id2)
      {
          if (!id1.getAlgorithm().equals(id2.getAlgorithm()))
          {
              return false;
          }
  
          if (id1.getParameters() == null)
          {
              return !(id2.getParameters() != null && !id2.getParameters().equals(DERNull.INSTANCE));
          }
  
          if (id2.getParameters() == null)
          {
              return !(id1.getParameters() != null && !id1.getParameters().equals(DERNull.INSTANCE));
          }
  
          return id1.getParameters().equals(id2.getParameters());
      }
docs: Compare two algorithm identifier.
  
  @param id1 an algorithm identifier.
  @param id2 another algorithm identifier.
  @return true if both algorithm identifier are equals, false otherwise.