<commit_before>/* Copyright (c) 2008, <NAME>

   Permission to use, copy, modify, and/or distribute this software
   for any purpose with or without fee is hereby granted, provided
   that the above copyright notice and this permission notice appear
   in all copies.

   There is NO WARRANTY for this software.  See license.txt for
   details. */

package java.util;

public class HashSet<T> implements Set<T> {
  private static final Object Value = new Object();

  private final HashMap<T, Object> map;

  public HashSet(Collection<? extends T> c) {
    map = new HashMap(c.size());
    addAll(c);
  }

  public HashSet(int capacity) {
    map = new HashMap(capacity);
  }

  public HashSet() {
    this(0);
  }

  public int size() {
    return map.size();
  }

  public boolean isEmpty() {
    return map.isEmpty();
  }

  public boolean contains(T element) {
    return map.containsKey(element);
  }

  public boolean add(T element) {
    return map.put(element, Value) != Value;
  }

  public boolean addAll(Collection<? extends T> collection) {
    boolean change = false;
    for (T t: collection) if (add(t)) change = true;
    return change;
  }

  public boolean remove(T element) {
    return map.remove(element) != Value;
  }

  public <T> T[] toArray(T[] array) {
    return Collections.toArray(this, array);
  }

  public void clear() {
    map.clear();
  }

  public Iterator<T> iterator() {
    return new MyIterator(map.iterator());
  }

  private static class MyIterator<T> implements Iterator<T> {
    private final Iterator<Map.Entry<T, Object>> it;

    public MyIterator(Iterator<Map.Entry<T, Object>> it) {
      this.it = it;
    }

    public T next() {
      return it.next().getKey();
    }

    public boolean hasNext() {
      return it.hasNext();<commit_msg>implement HashSet.toString<commit_after>/* Copyright (c) 2008, <NAME>

   Permission to use, copy, modify, and/or distribute this software
   for any purpose with or without fee is hereby granted, provided
   that the above copyright notice and this permission notice appear
   in all copies.

   There is NO WARRANTY for this software.  See license.txt for
   details. */

package java.util;

public class HashSet<T> implements Set<T> {
  private static final Object Value = new Object();

  private final HashMap<T, Object> map;

  public HashSet(Collection<? extends T> c) {
    map = new HashMap(c.size());
    addAll(c);
  }

  public HashSet(int capacity) {
    map = new HashMap(capacity);
  }

  public HashSet() {
    this(0);
  }

  public int size() {
    return map.size();
  }

  public boolean isEmpty() {
    return map.isEmpty();
  }

  public boolean contains(T element) {
    return map.containsKey(element);
  }

  public boolean add(T element) {
    return map.put(element, Value) != Value;
  }

  public boolean addAll(Collection<? extends T> collection) {
    boolean change = false;
    for (T t: collection) if (add(t)) change = true;
    return change;
  }

  public boolean remove(T element) {
    return map.remove(element) != Value;
  }

  public <T> T[] toArray(T[] array) {
    return Collections.toArray(this, array);
  }

  public void clear() {
    map.clear();
  }

  public Iterator<T> iterator() {
    return new MyIterator(map.iterator());
  }

  public String toString() {
    return Collections.toString(this);
  }

  private static class MyIterator<T> implements Iterator<T> {
    private final Iterator<Map.Entry<T, Object>> it;

    public MyIterator(Iterator<Map.Entry<T, Object>> it) {
      this.it = it;
    }

    public T next() {
      return it.next().getKey();
    }

    public boolean hasNext() {
      return it.hasNext();
{'fraction_non_alphanumeric': 0.11702127659574468, 'fraction_numerical': 0.002727768685215494, 'mean_word_length': 3.0835189309576836, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3495479', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1097, 'n_words': 367}