@Test public void testGeneratingUniqueRefIdWithEmptyTableMapping() { RefLog refLog = new RefLog(); String refId = RandomHasher.generateRefId(refLog); assertFalse(isNullOrEmpty(refId)); }
public static String generateRefId(RefLog refLog) { checkArgument(refLog != null, "You must specify a 'refLog'."); Set<String> refIds = refLog.getTableRefs().stream() .map(TableRef::getRefId) .collect(Collectors.toSet()); String hash = "table_" + generateHash(); while (refIds.contains(hash)) { hash = "table_" + generateHash(); } return hash; }
RandomHasher { public static String generateRefId(RefLog refLog) { checkArgument(refLog != null, "You must specify a 'refLog'."); Set<String> refIds = refLog.getTableRefs().stream() .map(TableRef::getRefId) .collect(Collectors.toSet()); String hash = "table_" + generateHash(); while (refIds.contains(hash)) { hash = "table_" + generateHash(); } return hash; } }
RandomHasher { public static String generateRefId(RefLog refLog) { checkArgument(refLog != null, "You must specify a 'refLog'."); Set<String> refIds = refLog.getTableRefs().stream() .map(TableRef::getRefId) .collect(Collectors.toSet()); String hash = "table_" + generateHash(); while (refIds.contains(hash)) { hash = "table_" + generateHash(); } return hash; }  }
RandomHasher { public static String generateRefId(RefLog refLog) { checkArgument(refLog != null, "You must specify a 'refLog'."); Set<String> refIds = refLog.getTableRefs().stream() .map(TableRef::getRefId) .collect(Collectors.toSet()); String hash = "table_" + generateHash(); while (refIds.contains(hash)) { hash = "table_" + generateHash(); } return hash; }  static String generateHash(); static String generateRefId(RefLog refLog); }
RandomHasher { public static String generateRefId(RefLog refLog) { checkArgument(refLog != null, "You must specify a 'refLog'."); Set<String> refIds = refLog.getTableRefs().stream() .map(TableRef::getRefId) .collect(Collectors.toSet()); String hash = "table_" + generateHash(); while (refIds.contains(hash)) { hash = "table_" + generateHash(); } return hash; }  static String generateHash(); static String generateRefId(RefLog refLog);  }