<commit_before>/**
 * 
 */
package org.pentaho.di.trans.steps.switchcase;

import java.util.ArrayList;

import org.pentaho.di.core.BlockingRowSet;
import org.pentaho.di.core.RowSet;

public class ContainsKeyToRowSetMap extends KeyToRowSetMap
{
    protected ArrayList<String> list = new ArrayList<String>();
    
    protected ContainsKeyToRowSetMap() { super(); }

    protected RowSet get(Object value)
    {
        String valueStr = (String)value;
        for (String key : list)
        {
            if (valueStr.contains(key))
                return map.get(key);
        }
        return null;
    }
    
    protected void put(Object key, BlockingRowSet rowSet)
    {
        super.put(key, rowSet);
        list.add((String)key);
    }
}<commit_msg>PDI-4207 : Switch / Case is not evaluating correct when "Use string contains comparison" is checked<commit_after>/**
 * 
 */
package org.pentaho.di.trans.steps.switchcase;

import java.util.ArrayList;

import org.pentaho.di.core.RowSet;

public class ContainsKeyToRowSetMap extends KeyToRowSetMap
{
    protected ArrayList<String> list = new ArrayList<String>();
    
    protected ContainsKeyToRowSetMap() { super(); }

    protected RowSet get(Object value)
    {
        String valueStr = (String)value;
        for (String key : list)
        {
            if (valueStr.contains(key))
                return map.get(key);
        }
        return null;
    }
    
    protected void put(Object key, RowSet rowSet)
    {
        super.put(key, rowSet);
        list.add((String)key);
    }
}
{'fraction_non_alphanumeric': 0.1081777205408886, 'fraction_numerical': 0.0025756600128783, 'mean_word_length': 2.5, 'pattern_counts': {'":': 0, '<': 7, '<?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': '419354', 'n_tokens_mistral': 479, 'n_tokens_neox': 468, 'n_words': 107}