code: @SuppressWarnings("unchecked") // map output key class
    private K[] readPartitions(FileSystem fs, Path p, Class<K> keyClass,
        JobConf job) throws IOException {
      SequenceFile.Reader reader = new SequenceFile.Reader(fs, p, job);
      ArrayList<K> parts = new ArrayList<K>();
      K key = (K) ReflectionUtils.newInstance(keyClass, job);
      NullWritable value = NullWritable.get();
      while (reader.next(key, value)) {
        parts.add(key);
        key = (K) ReflectionUtils.newInstance(keyClass, job);
      }
      reader.close();
      return parts.toArray((K[])Array.newInstance(keyClass, parts.size()));
    }
docs: matching key types enforced by passing in