<commit_before>/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.util.containers;

import java.util.Map;

/**
 * @author peter
 */
public abstract class ConcurrentFactoryMap<T,V> extends FactoryMap<T,V> {
  @Override
  protected Map<T, V> createMap() {
    return new ConcurrentHashMap<T,V>();
  }
}<commit_msg>use backported V8 CHM only for Oracle or Apple JDK (IDEA-116404 Java code compilation does not work with IBM JDK)<commit_after>/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.util.containers;

import com.intellij.openapi.util.SystemInfo;

import java.util.Map;

/**
 * @author peter
 */
public abstract class ConcurrentFactoryMap<T,V> extends FactoryMap<T,V> {

  private interface MapFactory {
    int DEFAULT_CONCURRENCY_LEVEL = Runtime.getRuntime().availableProcessors();

    MapFactory V8_MAP_FACTORY = new MapFactory() {
      public <T, V> Map<T, V> createMap() {
        return new ConcurrentHashMap<T,V>();
      }
    };
    MapFactory DEFAULT_MAP_FACTORY = new MapFactory() {
      public <T, V> Map<T, V> createMap() {
        return new java.util.concurrent.ConcurrentHashMap<T,V>(16, 0.75f, DEFAULT_CONCURRENCY_LEVEL);
      }
    };

    <T, V> Map<T, V> createMap();
  }

  private static final MapFactory ourMapFactory = SystemInfo.isOracleJvm || SystemInfo.isAppleJvm? MapFactory.V8_MAP_FACTORY : MapFactory.DEFAULT_MAP_FACTORY;

  @Override
  protected Map<T, V> createMap() {
    return ourMapFactory.createMap();
  }
}
{'fraction_non_alphanumeric': 0.09745762711864407, 'fraction_numerical': 0.014637904468412942, 'mean_word_length': 3.9092627599243857, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4265876', 'n_tokens_mistral': 797, 'n_tokens_neox': 765, 'n_words': 274}