/*
 * Copyright (c) 2015-2019 Vladimir Schneider <vladimir.schneider@gmail.com>
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.vladsch.smart;

import java.util.Iterator;

class IterableAdapter<V, R> implements Iterable<R> {
    final Iterable<V> iterable;
    final DataValueComputable<V, R> adapter;

    public IterableAdapter(Iterable<V> iterable, DataValueComputable<V, R> adapter) {
        this.iterable = iterable;
        this.adapter = adapter;
    }

    @Override
    public Iterator<R> iterator() {
        return new IteratorAdapter<V,R>(iterable.iterator(), adapter);
    }
}

/*
 * Copyright (c) 2015-2019 Vladimir Schneider <vladimir.schneider@gmail.com>
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package com.vladsch.smart;

import org.jetbrains.annotations.NotNull;

import java.util.Iterator;

class IterableAdapter<V, R> implements Iterable<R> {
    final Iterable<V> iterable;
    final DataValueComputable<V, R> adapter;

    public IterableAdapter(Iterable<V> iterable, DataValueComputable<V, R> adapter) {
        this.iterable = iterable;
        this.adapter = adapter;
    }

    @NotNull
    @Override
    public Iterator<R> iterator() {
        return new IteratorAdapter<V,R>(iterable.iterator(), adapter);
    }
}

fix warnings, add deprecated comments, fix nullability annotations