putAll method

RT putAll(
  1. Iterable<VT> putValues
)

PK...primary key VT...vlaue type RT... return type

value を追加 もしくは 上書き する.

putAll によって RosterPatternExceptionA は発生しない.
なので 呼び出し元は これを throw out する必要がある.

Implementation

RT putAll(Iterable<VT> putValues) {

    final List<VT> list = [];

    // values の中に putValues と同じものがあれば putValues と差し替える.
    for (final value in values) {

        bool flag = true;

        for (final putValue in putValues) {
            if (value.primaryKey == putValue.primaryKey) {
                list.add(putValue);
                flag = false;
            }
        }

        if (flag) list.add(value);

    }

    // values の 中に存在しない putValues を追加する.
    for (final putValue in putValues) {

        final containsPrimaryKeyResult = containsPrimaryKey(putValue.primaryKey);

        if (!containsPrimaryKeyResult.wrapped) list.add(putValue);

    }

    return internalFactory(list);

}