code: public int compare(Attribute a, Attribute b) {
          int result = a.getId().toString().compareTo(b.getId().toString());
  
          if (result == 0) {
              result = a.getType().toString().compareTo(b.getType().toString());
          } else {
              return result;
          }
  
          if (result == 0) {
              result = a.getValue().encode().compareTo(b.getValue().encode());
          } else {
              return result;
          }
  
          if (result == 0
                  && (a.getIssueInstant() != null || b.getIssueInstant() != null)) {
              if (a.getIssueInstant() == null && b.getIssueInstant() == null) {
                  result = 0;
              } else if (a.getIssueInstant() != null
                      && b.getIssueInstant() == null) {
                  result = 1;
              } else if (a.getIssueInstant() == null
                      && b.getIssueInstant() != null) {
                  result = -1;
              } else {
                  result =
                          a.getIssueInstant().encode().compareTo(b
                                  .getIssueInstant().encode());
              }
          }
  
          return result;
      }
docs: /*
  (non-Javadoc)
  @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)