Source:
<code>public List<PathDetailsBuilder> createPathDetailsBuilders(List<String> requestedPathDetails, FlagEncoder encoder, Weighting weighting) { List<PathDetailsBuilder> builders = new ArrayList<>(); if (requestedPathDetails.contains(AVERAGE_SPEED)) builders.add(new DecimalDetails(AVERAGE_SPEED, encoder.getAverageSpeedEnc(), false)); if (requestedPathDetails.contains(STREET_NAME)) builders.add(new StreetNameDetails()); if (requestedPathDetails.contains(EDGE_ID)) builders.add(new EdgeIdDetails()); if (requestedPathDetails.contains(TIME)) builders.add(new TimeDetails(weighting)); if (requestedPathDetails.contains(DISTANCE)) builders.add(new DistanceDetails()); for (String key : Arrays.asList(MaxSpeed.KEY, MaxWidth.KEY, MaxHeight.KEY, MaxWeight.KEY)) { if (requestedPathDetails.contains(key) && encoder.hasEncodedValue(key)) builders.add(new DecimalDetails(key, encoder.getDecimalEncodedValue(key), true)); } <START> for (Map.Entry entry : Arrays.asList(new MapEntry<>(RoadClass.KEY, RoadClass.class), <END> new MapEntry<>(RoadEnvironment.KEY, RoadEnvironment.class), new MapEntry<>(Surface.KEY, Surface.class), new MapEntry<>(RoadAccess.KEY, RoadAccess.class), new MapEntry<>(Toll.KEY, Toll.class), new MapEntry<>(Country.KEY, Country.class))) { String key = (String) entry.getKey(); if (requestedPathDetails.contains(key) && encoder.hasEncodedValue(key)) builders.add(new EnumDetails(key, encoder.getEnumEncodedValue(key, (Class<Enum>) entry.getValue()))); } if (requestedPathDetails.size() != builders.size()) { throw new IllegalArgumentException("You requested the details " + requestedPathDetails + " but we could only find " + builders); } return builders; }</code><technical_language>extract arrays class level</technical_language>

Target:
public List<PathDetailsBuilder> createPathDetailsBuilders(List<String> requestedPathDetails, FlagEncoder encoder, Weighting weighting) { List<PathDetailsBuilder> builders = new ArrayList<>(); if (requestedPathDetails.contains(AVERAGE_SPEED)) builders.add(new DecimalDetails(AVERAGE_SPEED, encoder.getAverageSpeedEnc())); if (requestedPathDetails.contains(STREET_NAME)) builders.add(new StreetNameDetails()); if (requestedPathDetails.contains(EDGE_ID)) builders.add(new EdgeIdDetails()); if (requestedPathDetails.contains(TIME)) builders.add(new TimeDetails(weighting)); if (requestedPathDetails.contains(DISTANCE)) builders.add(new DistanceDetails()); for (String key : Arrays.asList(MaxSpeed.KEY, MaxWidth.KEY, MaxHeight.KEY, MaxWeight.KEY)) { if (requestedPathDetails.contains(key) && encoder.hasEncodedValue(key)) builders.add(new DecimalDetails(key, encoder.getDecimalEncodedValue(key))); } for (Map.Entry entry : Arrays.asList(new MapEntry<>(RoadClass.KEY, RoadClass.class), new MapEntry<>(RoadEnvironment.KEY, RoadEnvironment.class), new MapEntry<>(Surface.KEY, Surface.class), new MapEntry<>(RoadAccess.KEY, RoadAccess.class), new MapEntry<>(Toll.KEY, Toll.class), new MapEntry<>(Country.KEY, Country.class))) { String key = (String) entry.getKey(); if (requestedPathDetails.contains(key) && encoder.hasEncodedValue(key)) builders.add(new EnumDetails(key, encoder.getEnumEncodedValue(key, (Class<Enum>) entry.getValue()))); } if (requestedPathDetails.size() != builders.size()) { throw new IllegalArgumentException("You requested the details " + requestedPathDetails + " but we could only find " + builders); } return builders; }