Creates collection classes and methods for elements.
 @param [Array<Symbol>] elements for which to create collection classes
   and methods.
540184
def has_many(*elements)
      elements.each do |element|
        class_name_plural = element.to_s.split("_").map {|e| e.capitalize}.join
        class_name = class_name_plural.chop
        adapter_class = self.to_s.scan(/(.*)::/).flatten.first
        clazz = RAutomation.constants.include?(class_name) ? RAutomation : class_eval(adapter_class)
        clazz.class_eval %Q{
            class #{class_name_plural}
              include Enumerable

              def initialize(window, locators)
               if locators[:hwnd] || locators[:pid]
                raise UnsupportedLocatorException, 
                  ":hwnd or :pid in " + locators.inspect + " are not supported for #{adapter_class}::#{class_name_plural}"
                end

                @window = window
                @locators = locators
              end

              def each
                i = -1 
                while true
                  args = [@window, @locators.merge(:index => i += 1)].compact
                  object = #{clazz}::#{class_name}.new(*args)
                  break unless object.exists?
                  yield object
                end
              end

              def method_missing(name, *args)
                ary = self.to_a
                ary.respond_to?(name) ? ary.send(name, *args) : super
              end
            end
        }

        class_eval %Q{
            def #{element}(locators = {})
              #{adapter_class}::#{class_name_plural}.new(@window || self, locators)
            end
        }
      end
    end
264549
def create_class( name , superclass = nil )
      raise "create_class #{name.class}" unless name.is_a? Symbol
      superclass = :Object unless superclass
      raise "create_class #{superclass.class}" unless superclass.is_a? Symbol
      type = get_type_by_class_name(superclass)
      c = Class.new(name , superclass , type )
      classes[name] = c
    end
1125031
@SafeVarargs
	public static <E> ArrayList<E> newArrayList(E... elements) {
		ArrayList<E> list = new ArrayList<E>();
		Collections.addAll(list, elements);
		return list;
	}
449798
private static <E extends Element> List<E> listFilter(Iterable<? extends Element> elements,
                                                          Set<ElementKind> targetKinds,
                                                          Class<E> clazz) {
        List<E> list = new ArrayList<E>();
        for (Element e : elements) {
            if (targetKinds.contains(e.getKind()))
                list.add(clazz.cast(e));
        }
        return list;
    }
469899
function(cls,methods) {
    var keys = Object.keys(methods);
    var len = keys.length;
    for (var i = 0; i < len; i++) {
      var key = keys[i];
      cls.prototype[key] = lib.method.createMethod(methods[key]);
    }
    return cls;
  }
414823
function addClass( element ) {
  const addClassNamesArray = _sliceArgs( arguments );
  if ( hasClassList ) {
    element.classList.add.apply( element.classList, addClassNamesArray );
  } else {
    var classes = element.className.split( ' ' );
    addClassNamesArray.forEach( function( name ) {
      if ( classes.indexOf( name ) === -1 ) {
        classes.push( name );
      }
    } );
    element.className = classes.join( ' ' );
  }

  return element;
}
916444
function addClass(element, className) {
  let elements = [].concat(element);
  let classes = [];
  let n = elements.length;

  if (!assert((typeof className === 'string') || (className instanceof Array), 'Invalid class name specified. Must be either a string or an array of strings.')) return;

  if (typeof className === 'string')
    classes.push(className);
  else
    classes = className;

  let nClasses = classes.length;

  for (let i = 0; i < n; i++) {
    let e = elements[i];

    for (let j = 0; j < nClasses; j++) {
      let c = classes[j];

      if (!assert(typeof c === 'string', 'Invalid class detected: ' + c)) continue;
      if (hasClass(e, c)) continue;

      e.className = e.className + ((e.className === '') ? '' : ' ') + c;
    }
  }
}
717424
def instantiate_subclasses(klass)
      klass.descendants.select { |c| !safe || c.safe }.sort.map do |c|
        c.new(config)
      end
    end
199234
public static function register_elements() {
		foreach ( self::$_elements as $element => $locations ) {
			$class = self::get_element_class_name( $element );

			if ( method_exists( $class, 'init' ) ) {
				call_user_func( [ $class, 'init' ], $locations );
			}
		}
	}
143161
def create(element, element_id=nil, &block)
      element = initialize_element(element, element_id)
      style_and_context(element, element_id, &block)

      element
    end
1245822
@SafeVarargs
	public static <E> HashSet<E> newHashSet(E... elements) {
		HashSet<E> set = new HashSet<E>();
		Collections.addAll(set, elements);
		return set;
	}
474570
public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements) {
		ArrayList<E> list = newArrayList();
		while (elements.hasNext()) {
			list.add(elements.next());
		}
		return list;
	}
1373731
function detect_class_members_from_array(cls, ast) {
  cls["members"] = [];
  return _.each(ast["elements"], function(el) {
    detect_method_or_property(cls, key_value(el), el, el);
  });
}
803564
def _add_assignment_methods(name, element_method, opts)
      assign_method = opts.delete(:assign_method)
      return unless assign_method

      define_method("#{name}=") do |value|
        return assign_method.call(name, self, value) if assign_method.is_a?(Proc)

        send(element_method).send(assign_method, value)
      end
    end
759738
def create_collection_class(collection_name)
      unless class_exists?(collection_name)
        self.const_set(collection_name, Class.new do
          include Foggy::Collection
        end)
      end
    end
543899
public static MarkedElement markup(IRenderingElement elem, String... classes) {
        assert elem != null;
        MarkedElement tagElem = new MarkedElement(elem);
        for (String cls : classes)
            tagElem.aggClass(cls);
        return tagElem;
    }
273297
def add_class(class_name)
      @fragment.each_element do |c|
        c.attributes['class'] = ((c.attributes['class']||'').split(' ') + [class_name]).join(' ')
      end
    end