This will make a deep clone of the passed in Iterable.
This will also replace any patterns already set.

@param patterns the patterns to set
427596
@SuppressWarnings("UnusedDeclaration")
    public void setPatterns(Iterable<AccountPatternData> patterns) {
        this.patterns.clear();
        for (AccountPatternData data : patterns) {
            this.patterns.add(new AccountPatternData(data));
        }
    }
1184603
public void replaceStringChildren(List<String> strings) {
		ArrayList<StringEntity> entities = new ArrayList<>();
		for (String string : strings) {
			StringEntity entity = new StringEntity();
			entity.setValue(string);
			entities.add(entity);
		}
		replaceAll(entities);
	}
247432
public Set<byte[]> keys(String pattern){
		Set<byte[]> keys = null;
		Jedis jedis = jedisPool.getResource();
		try{
			keys = jedis.keys(pattern.getBytes());
		}finally{
			jedisPool.returnResource(jedis);
		}
		return keys;
	}
420005
public void setLayers(java.util.Collection<Layer> layers) {
        if (layers == null) {
            this.layers = null;
            return;
        }

        this.layers = new java.util.ArrayList<Layer>(layers);
    }
523177
List<Node> get(final Pattern... patterns)
   {
      return AbsoluteGetQuery.INSTANCE.execute(this, includeRootPatternFirst(patterns));
   }
1058727
protected Pattern[] queryDetectionPattern(final Pattern... pattern) {
        if (pattern == null) {
            throw new IllegalArgumentException();
        } // end of if

        // ---

        if (this.queryDetection == null) {
            return pattern;
        } // end of if

        // ---

        final Pattern[] patterns = 
            new Pattern[this.queryDetection.length + pattern.length];

        System.arraycopy(this.queryDetection, 0, 
                         patterns, 0, 
                         this.queryDetection.length);

        int i = this.queryDetection.length;

        for (final Pattern p : pattern) {
            patterns[i++] = p;
        } // end of for

        return patterns;
    }
696772
public void setMethods(Set<String> methods) {
        this.methods = new HashSet<>();
        for (String method : methods) {
            this.methods.add(method.toUpperCase());
        }
    }
283435
private static <T> Iterator<Iterator<? extends T>> iterators(
      Iterable<? extends Iterable<? extends T>> iterables) {
    return new TransformedIterator<Iterable<? extends T>, Iterator<? extends T>>(
        iterables.iterator()) {
      @Override
      Iterator<? extends T> transform(Iterable<? extends T> from) {
        return from.iterator();
      }
    };
  }
578331
private void initializePattern(final String pattern) {
        final String[] split = pattern.split(Pattern.quote("*"), -1);
        final StringBuilder escapedPattern = new StringBuilder(Pattern.quote(split[0]));
        for (int i = 1; i < split.length; i++) {
            String quoted = Pattern.quote(split[i]);
            escapedPattern.append("([^.]*)").append(quoted);
        }

        final String regex = "^" + escapedPattern.toString() + "$";
        this.patternStr = regex;
        this.pattern = Pattern.compile(regex);
    }
781012
public void setFaceMatches(java.util.Collection<FaceMatch> faceMatches) {
        if (faceMatches == null) {
            this.faceMatches = null;
            return;
        }

        this.faceMatches = new java.util.ArrayList<FaceMatch>(faceMatches);
    }
1317461
public boolean changePattern (FormationPattern<T> pattern) {
		// Find out how many slots we have occupied
		int occupiedSlots = slotAssignments.size;

		// Check if the pattern supports one more slot
		if (pattern.supportsSlots(occupiedSlots)) {
			setPattern(pattern);

			// Update the slot assignments and return success
			updateSlotAssignments();

			return true;
		}

		return false;
	}
66811
public void setPattern(String pattern) {
        if (pattern == null || pattern.length() <= 0) {
            throw new IllegalArgumentException(
                    "Pattern to search for can not be null or of length 0");
        }
        pattern_.text_ = pattern;
        initialize();
    }
890617
public FulltextMatch setPatterns(
                    final Collection<String> patterns
                    )
    {
        if (patterns == null  ||  patterns.size() == 0) {
            clearPatterns();
            return this;
        }

        synchronized (patterns) {
            for (String  pattern : patterns) {
                if (pattern == null  ||  pattern.length() == 0) {
                    throw new IllegalArgumentException( "null element" );
                }
            }

            clearPatterns();
            for (String  pattern : patterns) {
                addPattern( pattern );
            }
        }

        return this;
    }
946454
public void setAuthorizedPatternArray(String[] patterns) {
        Matcher matcher;

        patterns: for (String pattern: patterns) {
            if ((matcher = IPv4_ADDRESS_PATTERN.matcher(pattern)).matches()) {
                short[] address = new short[4];
                for (int i = 0; i < address.length; ++i) {
                    String p = matcher.group(i+1);
                    try {
                        address[i] = Short.parseShort(p);
                        if (address[i] > 255) {
                            _logger.warning("Invalid pattern ignored: " + pattern);
                            continue patterns;
                        }
                    } catch (Exception x) {
                        if ("*".equals(p)) {
                            address[i] = 256;
                        } else {
                            _logger.warning("Invalid pattern ignored: " + pattern);
                            continue patterns;
                        }
                    }
                }
                _logger.fine("normalized ipv4 address pattern = " + Strings.join(address, '.'));
                _ipv4patterns.add(address);
            } else if ((matcher = IPv6_ADDRESS_PATTERN.matcher(pattern)).matches()) {
                short[] address = new short[16];
                for (int i = 0; i < address.length; i += 2) {
                    String p = matcher.group(i/2+1);
                    try {
                        int v = Integer.parseInt(p, 16);
                        address[i] = (short)(v >> 8);
                        address[i+1] = (short)(v & 0x00ff);
                    } catch (Exception x) {
                        if ("*".equals(p)) {
                            address[i] = 256;
                            address[i+1] = 256;
                        } else {
                            _logger.warning("Invalid pattern ignored: " + pattern);
                            continue patterns;
                        }
                    }
                }
                _logger.fine("normalized ipv6 address pattern = " + Strings.join(address, '.'));
                _ipv6patterns.add(address);
            } else {
                _logger.warning("Invalid pattern ignored: " + pattern);
            }
        }
    }
687147
private Pattern[] validateAndMergePatternInput(final Pattern pattern, final Pattern... patterns) {
        // Precondition check
        if (pattern == null) {
            throw new IllegalArgumentException("At least one pattern must not be specified");
        }
        final List<Pattern> merged = new ArrayList<Pattern>();
        merged.add(pattern);
        for (final Pattern p : patterns) {
            merged.add(p);
        }
        return merged.toArray(PATTERN_CAST);
    }
694100
public static List<Pattern> getPatternsFromStrings(List<String> strings) {
    List<Pattern> patterns = Lists.newArrayList();
    for (String s : strings) {
      patterns.add(Pattern.compile(s));
    }
    return patterns;
  }
656795
public void setChildren(java.util.Collection<Child> children) {
        if (children == null) {
            this.children = null;
            return;
        }

        this.children = new java.util.ArrayList<Child>(children);
    }