Creates new instance of {@link PutResults}.

@param putResults results of Put Operation.
@param <T>        type of objects.
@return immutable instance of {@link PutResults}.
509898
@NonNull
    public static <T> PutResults<T> newInstance(@NonNull Map<T, PutResult> putResults) {
        return new PutResults<T>(putResults);
    }
566614
public Result<T> put(T service)
    {
        check(service);

        ServiceType serviceType = service.resolveServiceType();
        T previous = null;

        lock();
        try
        {
            ServiceType existingServiceType = keysToServiceTypes.get(service.getKey());
            if (existingServiceType != null && !existingServiceType.equals(serviceType))
                throw new ServiceLocationException("Invalid registration of service " + service.getKey() +
                                                   ": already registered under service type " + existingServiceType +
                                                   ", cannot be registered also under service type " + serviceType, SLPError.INVALID_REGISTRATION);
            keysToServiceTypes.put(service.getKey(), serviceType);
            previous = keysToServiceInfos.put(service.getKey(), service);
            service.setRegistered(true);
            if (previous != null) previous.setRegistered(false);
        }
        finally
        {
            unlock();
        }

        notifyServiceAdded(previous, service);
        return new Result<T>(previous, service);
    }
816084
public static SQLiteEvent createInsertWithId(Long result) {
		return new SQLiteEvent(SqlModificationType.INSERT, null, result, null);
	}
774556
public void addResult(CmsResourceTypeStatResult result) {

        if (!m_results.contains(result)) {
            m_results.add(result);
            m_updated = false;
        } else {
            m_results.remove(result);
            m_results.add(result);
            m_updated = true;
        }
    }
759811
public static OperationResult succeeded(long index, long eventIndex, byte[] result) {
    return new OperationResult(index, eventIndex, null, result);
  }
363797
public <T> T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions) throws SQLException {
		Integer dbColumnPos = columnPositions.get(columnName);
		if (dbColumnPos == null) {
			dbColumnPos = results.findColumn(columnName);
			columnPositions.put(columnName, dbColumnPos);
		}

		/*
		 * Subtle problem here. If the field is a foreign-field and/or a primitive and the value was null then we get 0
		 * from results.getInt() which mirrors the ResultSet. We have to specifically test to see if we have a null
		 * result with results.wasNull(...) afterwards so we return a null value to not create the sub-object or turn a
		 * Integer field into 0 instead of null.
		 * 
		 * But this presents a limitation. Sometimes people want to convert a result field value that is stored in the
		 * database as null into a non-null value when it comes out of the database. There is no way to do that because
		 * of the results.wasNull(...) checks after the fact then override the non-null value from the converter.
		 */
		@SuppressWarnings("unchecked")
		T converted = (T) fieldConverter.resultToJava(this, results, dbColumnPos);
		if (fieldConfig.isForeign()) {
			/*
			 * If your foreign field is a primitive and the value was null then this would return 0 from
			 * results.getInt(). We have to specifically test to see if we have a foreign field so if it is null we
			 * return a null value to not create the sub-object.
			 */
			if (results.wasNull(dbColumnPos)) {
				return null;
			}
		} else if (dataPersister.isPrimitive()) {
			if (fieldConfig.isThrowIfNull() && results.wasNull(dbColumnPos)) {
				throw new SQLException(
						"Results value for primitive field '" + field.getName() + "' was an invalid null value");
			}
		} else if (!fieldConverter.isStreamType() && results.wasNull(dbColumnPos)) {
			// we can't check if we have a null if this is a stream type
			return null;
		}
		return converted;
	}
624722
public void setModificationResults(java.util.Collection<ReservedInstancesModificationResult> modificationResults) {
        if (modificationResults == null) {
            this.modificationResults = null;
            return;
        }

        this.modificationResults = new com.amazonaws.internal.SdkInternalList<ReservedInstancesModificationResult>(modificationResults);
    }
446483
@NonNull
    public static PutResult newInsertResult(
            long insertedId,
            @NonNull String affectedTable,
            @Nullable Collection<String> affectedTags
    ) {
        checkNotNull(affectedTable, "Please specify affected table");
        return new PutResult(insertedId, null, singleton(affectedTable), nonNullSet(affectedTags));
    }
460854
private static Converter<List<String>, Object> createListConverter(Type resultType) {
    // Use boxed type if raw type is primitive type. Otherwise the type won't change.
    Class<?> resultClass = getRawClass(resultType);

    // For string, just return the first value
    if (resultClass == String.class) {
      return new BasicConverter(defaultValue(resultClass)) {
        @Override
        protected Object convert(String value) throws Exception {
          return value;
        }
      };
    }

    // Creates converter based on the type

    // Primitive
    Converter<List<String>, Object> converter = createPrimitiveTypeConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // String constructor
    converter = createStringConstructorConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // Static string argument methods
    converter = createStringMethodConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // Collection
    converter = createCollectionConverter(resultType);
    if (converter != null) {
      return converter;
    }

    throw new IllegalArgumentException("Unsupported type " + resultType + " of type class " + resultType.getClass());
  }
1293816
public WriterFlushResult withFlushResult(WriterFlushResult flushResult) {
        this.flushedBytes.addAndGet(flushResult.flushedBytes.get());
        this.mergedBytes.addAndGet(flushResult.mergedBytes.get());
        this.flushedAttributes.addAndGet(flushResult.flushedAttributes.get());
        return this;
    }
284221
public T uniqueResult()
	{
		if (list == null || list.size() == 0)
			return null;
		else if (list.size() == 1)
			return list.get(0);
		else
			throw new IllegalArgumentException("Asked for unique result but resultset contained " + list.size() + " results!");
	}
627087
public void setResults(java.util.Collection<String> results) {
        if (results == null) {
            this.results = null;
            return;
        }

        this.results = new com.amazonaws.internal.SdkInternalList<String>(results);
    }
920470
public static <T> Parser<T> conventionalParser(Class<T> resultType)
      throws NoSuchMethodException {
    if (resultType == String.class) {
      @SuppressWarnings("unchecked") // T == String
      Parser<T> identity = (Parser<T>) IDENTITY;
      return identity;
    }

    final Class<T> wrappedResultType = Primitives.wrap(resultType);

    for (String methodName : CONVERSION_METHOD_NAMES) {
      try {
        final Method method = wrappedResultType.getDeclaredMethod(methodName, String.class);

        if (Util.isStatic(method) && wrappedResultType.isAssignableFrom(method.getReturnType())) {
          method.setAccessible(true); // to permit inner enums, etc.
          return new InvokingParser<T>() {
            @Override protected T invoke(String input) throws Exception {
              return wrappedResultType.cast(method.invoke(null, input));
            }
          };
        }
      } catch (Exception tryAgain) {
      }
    }

    final Constructor<T> constr = wrappedResultType.getDeclaredConstructor(String.class);
    constr.setAccessible(true);
    return new InvokingParser<T>() {
      @Override protected T invoke(String input) throws Exception {
        return wrappedResultType.cast(constr.newInstance(input));
      }
    };
  }
995343
@SuppressWarnings("rawtypes")
    public static FutureResult create(Throwable t) {
        final SMTPException exception;
        if (t instanceof SMTPException) {
            exception = (SMTPException) t;
        } else if (t instanceof ConnectException) {
            exception = new SMTPConnectionException(t);
        } else {
            exception = new SMTPException("Exception while try to deliver msg", t);
        }
        return new FutureResult(exception) {

            @Override
            public Object getResult() {
                return null;
            }
            
        };
        
    }
1228972
public void setResult(java.util.Collection<WorkspacesIpGroup> result) {
        if (result == null) {
            this.result = null;
            return;
        }

        this.result = new com.amazonaws.internal.SdkInternalList<WorkspacesIpGroup>(result);
    }
278354
void setResult(JCExpression tree, Type type) {
        result = type;
        if (env.info.isSpeculative) {
            //if we are in a speculative branch we can save the type in the tree itself
            //as there's no risk of polluting the original tree.
            tree.type = result;
        }
    }
304433
public static Result createResultForStage1(Result result) {
    VariableMap emptyVariableMap = new VariableMap(ImmutableMap.of());
    return new Result(
        result.errors,
        result.warnings,
        emptyVariableMap,
        emptyVariableMap,
        emptyVariableMap,
        null,
        null,
        "",
        null,
        null,
        null);
  }