Extract all matching fields (i.e. fields with the same name) into the result
array.

@param lhsFields
@param rhsFields
@param result
@return
559929
private int extractMatchingFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields, Type.Field[] result,
			LifetimeRelation lifetimes, LinkageStack stack) {
		int index = 0;
		// Extract all matching fields first.
		for (int i = 0; i != lhsFields.size(); ++i) {
			for (int j = 0; j != rhsFields.size(); ++j) {
				Type.Field lhsField = lhsFields.get(i);
				Type.Field rhsField = rhsFields.get(j);
				Identifier lhsFieldName = lhsField.getName();
				Identifier rhsFieldName = rhsField.getName();
				if (lhsFieldName.equals(rhsFieldName)) {
					Type type = apply(lhsField.getType(), rhsField.getType(), lifetimes, stack);
					Type.Field combined = new Type.Field(lhsFieldName, type);
					result[index++] = combined;
				}
			}
		}
		return index;
	}
333802
private Type.Field[] determinePivotFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
			LifetimeRelation lifetimes, LinkageStack stack) {
		Type.Field[] pivots = new Type.Field[lhsFields.size()];
		//
		for (int i = 0; i != lhsFields.size(); ++i) {
			Type.Field lhsField = lhsFields.get(i);
			Identifier lhsFieldName = lhsField.getName();
			for (int j = 0; j != rhsFields.size(); ++j) {
				Type.Field rhsField = rhsFields.get(j);
				Identifier rhsFieldName = rhsField.getName();
				if (lhsFieldName.equals(rhsFieldName)) {
					// Matched field, now compute its type.
					Type type = apply(lhsField.getType(), rhsField.getType(), lifetimes, stack);
					// Check whether is a pivot or not
					if (!(type instanceof Type.Void)) {
						// Yes, is a pivot
						pivots[i] = new Type.Field(lhsFieldName, type);
					}
					break;
				}
			}
		}
		return pivots;
	}
358574
public static List<OrderingResult> getOrderingResults(Result r) {
    if(r instanceof OrderingResult) {
      List<OrderingResult> ors = new ArrayList<>(1);
      ors.add((OrderingResult) r);
      return ors;
    }
    if(r instanceof HierarchicalResult) {
      return filterResults(((HierarchicalResult) r).getHierarchy(), r, OrderingResult.class);
    }
    return Collections.emptyList();
  }
659816
private List<String> getColumnResults(int columnIndex,
			UserCoreResult<?, ?, ?> results) {

		List<String> values = new ArrayList<>();
		while (results.moveToNext()) {
			values.add(results.getString(columnIndex));
		}

		return values;
	}
713266
function rejectFields(result, fields) {
    // If result is an array, then rejection rules are applied to each array entry
    if (_.isArray(result)) {
        return _.map(result, (single_entry) => _.omit(single_entry, fields));
    }
    return _.omit(result, fields);
}
282201
@SuppressWarnings("rawtypes")
	public List hmget(Object key, Object... fields) {
		Jedis jedis = getJedis();
		try {
			List<byte[]> data = jedis.hmget(keyToBytes(key), fieldsToBytesArray(fields));
			return valueListFromBytesList(data);
		}
		finally {close(jedis);}
	}
454300
private List<Field> getAllFields(List<Field> fields, Class<?> clazz) {
    // TODO consider caching the results of this.
    checkNotNull(fields);
    checkNotNull(clazz);

    fields.addAll(Arrays.asList(clazz.getDeclaredFields()));

    if (clazz.getSuperclass() != null) {
      getAllFields(fields, clazz.getSuperclass());
    }

    return Collections.unmodifiableList(fields);
  }
337426
private List<?> toList(Object results)
    {
        if (results instanceof Object[])
        {
            return Arrays.asList( (Object[]) results );
        }
        if (results instanceof Collection)
        {
            return new ArrayList<Object>( (Collection<?>) results );
        }
        return null;
    }
259274
public static List<Clustering<? extends Model>> getClusteringResults(Result r) {
    if(r instanceof Clustering<?>) {
      List<Clustering<?>> crs = new ArrayList<>(1);
      crs.add((Clustering<?>) r);
      return crs;
    }
    if(r instanceof HierarchicalResult) {
      return ResultUtil.filterResults(((HierarchicalResult) r).getHierarchy(), r, Clustering.class);
    }
    return Collections.emptyList();
  }
211287
public static List<Field> getAllFields(Class<?> clas) {
		JK.fixMe("add caching..");
		List<Field> list = new Vector<>();
		// start by fields from the super class
		if (clas.getSuperclass() != null) {
			list.addAll(getAllFields(clas.getSuperclass()));
		}
		Field[] fields = clas.getDeclaredFields();
		for (Field field : fields) {
			if (!Modifier.isStatic(field.getModifiers())) {
				list.add(field);
			}
		}
		return list;
	}
346621
@SuppressWarnings("unchecked")
  protected int hashFields(int hash, Map<FieldDescriptor, Object> map) {
    for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) {
      FieldDescriptor field = entry.getKey();
      Object value = entry.getValue();
      hash = (37 * hash) + field.getNumber();
      if (field.getType() != FieldDescriptor.Type.ENUM){
        hash = (53 * hash) + value.hashCode();
      } else if (field.isRepeated()) {
        List<? extends EnumLite> list = (List<? extends EnumLite>) value;
        hash = (53 * hash) + hashEnumList(list);
      } else {
        hash = (53 * hash) + hashEnum((EnumLite) value);
      }
    }
    return hash;
  }
549311
def select_fields(self, *fields):
        """"""
        if fields:
            if not isinstance(fields[0], basestring): 
                fields = list(fields[0]) + list(fields)[1:]

        for field_name in fields:
            field_name = self._normalize_field_name(field_name)
            self.select_field(field_name)
        return self
376309
function extractNamedFields(fields, input) {
  var output = Object.create(null);
  fields.forEach(function(field) {
    var subObject = input;
    for (var i = 0; i < field.path.length; i += 1) {
      if (subObject == undefined) {
        throw new Error("Unreachable: matched input will always have fields");
      }
      subObject = subObject[field.path[i]];
    }
    switch (field.typeShortcut) {
      // type matcher:
      case 1:
        subObject = global[field.type](subObject);
      break;
      // literal matcher:
      case 3:
        subObject = field.object;
      break;
    }
    output[field.name] = subObject;
  });
  return output;
}
627177
public static Matcher assignmentWithRhs(final Matcher rhsMatcher) {
    return new Matcher() {
      @Override public boolean matches(Node node, NodeMetadata metadata) {
        return node.isAssign() && rhsMatcher.matches(node.getLastChild(), metadata);
      }
    };
  }
370601
private static List<String> resolveFields(final Iterable<? extends String> fields) {
        final List<String> fieldList = new ArrayList<String>();

        for (final String field : fields) {
            Validate.isTrue(StringUtils.isNotBlank(field), "One of the specified fields was blank");
            fieldList.add(field.trim());
        }

        return fieldList;
    }
1115437
@SuppressWarnings("unchecked")
	public Q includeFields(final Set<String> fields) {
		if (this.fields == null) {
			this.fields = new HashSet<>();
		}

		if (fields != null) {
			this.fields.addAll(fields);
		}

		return (Q) this;
	}
957553
def _parse_fields(self, result, field_name):
        
        field_list = []
        for key, value in result.get('schema', {}).get(field_name, {}).items():
            if key not in field_list:
                field_list.append(key)
        return field_list