<commit_before>package com.uwetrottmann.tmdb2.entities;

import com.uwetrottmann.tmdb2.TmdbHelper;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TmdbDate {

    private static final ThreadLocal<DateFormat> TMDB_DATE_FORMAT =
            ThreadLocal.withInitial(() -> new SimpleDateFormat(TmdbHelper.TMDB_DATE_PATTERN));

    private final Date date;

    public TmdbDate(Date date) {
        this.date = date;
    }

    public TmdbDate(String date) {
        Date parsedDate;
        try {
            parsedDate = TMDB_DATE_FORMAT.get().parse(date);
        } catch (ParseException e) {
            parsedDate = null;
        }
        this.date = parsedDate;
    }

    @Override
    public String toString() {
        return TMDB_DATE_FORMAT.get().format(date);
    }

}<commit_msg>Do not use ThreadLocal.withInitial, not available on Android.<commit_after>package com.uwetrottmann.tmdb2.entities;

import com.uwetrottmann.tmdb2.TmdbHelper;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TmdbDate {

    // can not use ThreadLocal.withInitial as it requires Java 8
    private static final ThreadLocal<DateFormat> TMDB_DATE_FORMAT = new ThreadLocal<DateFormat>() {
        @Override
        public DateFormat initialValue() {
            return new SimpleDateFormat(TmdbHelper.TMDB_DATE_PATTERN);
        }
    };

    private final Date date;

    public TmdbDate(Date date) {
        this.date = date;
    }

    public TmdbDate(String date) {
        Date parsedDate;
        try {
            parsedDate = TMDB_DATE_FORMAT.get().parse(date);
        } catch (ParseException e) {
            parsedDate = null;
        }
        this.date = parsedDate;
    }

    @Override
    public String toString() {
        return TMDB_DATE_FORMAT.get().format(date);
    }

}
{'fraction_non_alphanumeric': 0.09081580297588507, 'fraction_numerical': 0.002565418163160595, 'mean_word_length': 2.735632183908046, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '4821623', 'n_tokens_mistral': 607, 'n_tokens_neox': 602, 'n_words': 128}