class CircularRecorder<T> {
    int size;
    AtomicInteger index = new AtomicInteger(0);
    Entry<?>[] array;

    public CircularRecorder(int size) {
        this.size = size;
        array = new Entry[size];
    }

    public void add(T t) {
        int i = index.getAndIncrement();
        if (i < 0) {
            i = -i;
        }
        array[i % size] = new Entry<>(t, System.currentTimeMillis());
    }

    // return the latest records map. map key is the record timestamp.
    @SuppressWarnings("unchecked")
    public Map<String, T> getRecords() {
        Map<String, T> map = new HashMap<>();
        for (int i = 0; i < size; i++) {
            Entry<?> temp = array[i];
            if (temp != null) {
                map.put(i + ":" + temp.timestamp, (T) temp.value);
            }
        }
        return map;
    }

    public void clear() {<FILL_FUNCTION_BODY>}

    static class Entry<T> {
        T value;
        long timestamp;

        public Entry(T value, long timestamp) {
            this.value = value;
            this.timestamp = timestamp;
        }
    }
}

        for (int i = 0; i < size; i++) {
            array[i] = null;
        }
        index.set(0);
    
<no_super_class>