public static String[] getDistinctStrings( String[] strings ) {
    if ( strings == null ) {
      return null;
    }
    if ( strings.length == 0 ) {
      return new String[] {};
    }

    String[] sorted = sortStrings( strings );
    List<String> result = new ArrayList<>();
    String previous = "";
    for ( int i = 0; i < sorted.length; i++ ) {
      if ( !sorted[i].equalsIgnoreCase( previous ) ) {
        result.add( sorted[i] );
      }
      previous = sorted[i];
    }

    return result.toArray( new String[result.size()] );
  }
@Test
  public void testGetDistinctStrings() {
    assertNull( Const.getDistinctStrings( null ) );
    assertTrue( Const.getDistinctStrings( new String[] {} ).length == 0 );
    Assert.assertArrayEquals( new String[] { "bar", "foo" }, Const.getDistinctStrings( new String[] { "foo", "bar", "foo",
      "bar" } ) );
  }