private static <K, V> Map<K, V> asMap(Iterable<? extends K> keys, Iterable<? extends V> values) throws IllegalArgumentException {
    Map<K, V> result = new HashMap<>();
    Iterator<? extends K> keyIterator = keys.iterator();
    Iterator<? extends V> valueIterator = values.iterator();
    while (keyIterator.hasNext()) {
      if (!valueIterator.hasNext()) {
        throw new IllegalArgumentException(
          String.format("Can't build for the given data. Reason: number of keys differs from number of values. "
                        + "Keys: %s, values: %s", keys, values)
        );
      }
      result.put(keyIterator.next(), valueIterator.next());
    }

    if (valueIterator.hasNext()) {
      throw new IllegalArgumentException(
        String.format("Can't build for the given data. Reason: number of keys differs from number of values. "
                      + "Keys: %s, values: %s", keys, values)
      );
    }
    return result;
  }
private static <K, V> Map<K, V> asMap(Iterable<? extends K> keys, Iterable<? extends V> values)