Lambdas: added applyToIterable (mass coversion), removed old copyright mentioning Braids (no reasons to copyright 3 trivial files)

This commit is contained in:
Maxmtg
2012-09-23 22:36:37 +00:00
parent 9ed73ff78a
commit 16f9f9d398
3 changed files with 53 additions and 51 deletions

View File

@@ -1,22 +1,19 @@
/* /*
* The files in the directory "net/slightlymagic/braids" and in all subdirectories of it (the "Files") are * Forge: Play Magic: the Gathering.
* Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's * Copyright (C) 2011 Forge Team
* main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
* or under the Apache License, as explained below.
* *
* The Files are additionally licensed under the Apache License, Version 2.0 (the * This program is free software: you can redistribute it and/or modify
* "Apache License"); you may not use the files in this directory except in * it under the terms of the GNU General Public License as published by
* compliance with one of its two licenses. You may obtain a copy of the Apache * the Free Software Foundation, either version 3 of the License, or
* License at * (at your option) any later version.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* Unless required by applicable law or agreed to in writing, software * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* distributed under the Apache License is distributed on an "AS IS" BASIS, * GNU General Public License for more details.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License for the specific language governing permissions and
* limitations under the Apache License.
* *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package forge.util.closures; package forge.util.closures;

View File

@@ -1,22 +1,19 @@
/* /*
* The files in the directory "net/slightlymagic/braids" and in all subdirectories of it (the "Files") are * Forge: Play Magic: the Gathering.
* Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's * Copyright (C) 2011 Forge Team
* main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
* or under the Apache License, as explained below.
* *
* The Files are additionally licensed under the Apache License, Version 2.0 (the * This program is free software: you can redistribute it and/or modify
* "Apache License"); you may not use the files in this directory except in * it under the terms of the GNU General Public License as published by
* compliance with one of its two licenses. You may obtain a copy of the Apache * the Free Software Foundation, either version 3 of the License, or
* License at * (at your option) any later version.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* Unless required by applicable law or agreed to in writing, software * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* distributed under the Apache License is distributed on an "AS IS" BASIS, * GNU General Public License for more details.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License for the specific language governing permissions and
* limitations under the Apache License.
* *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package forge.util.closures; package forge.util.closures;

View File

@@ -1,25 +1,25 @@
/* /*
* The files in the directory "net/slightlymagic/braids" and in all subdirectories of it (the "Files") are * Forge: Play Magic: the Gathering.
* Copyright 2011 Braids Cabal-Conjurer. They are available under either Forge's * Copyright (C) 2011 Forge Team
* main license (the GNU Public License; see LICENSE.txt in Forge's top directory)
* or under the Apache License, as explained below.
* *
* The Files are additionally licensed under the Apache License, Version 2.0 (the * This program is free software: you can redistribute it and/or modify
* "Apache License"); you may not use the files in this directory except in * it under the terms of the GNU General Public License as published by
* compliance with one of its two licenses. You may obtain a copy of the Apache * the Free Software Foundation, either version 3 of the License, or
* License at * (at your option) any later version.
* *
* http://www.apache.org/licenses/LICENSE-2.0 * This program is distributed in the hope that it will be useful,
* * but WITHOUT ANY WARRANTY; without even the implied warranty of
* Unless required by applicable law or agreed to in writing, software * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* distributed under the Apache License is distributed on an "AS IS" BASIS, * GNU General Public License for more details.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Apache License for the specific language governing permissions and
* limitations under the Apache License.
* *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package forge.util.closures; package forge.util.closures;
import java.util.ArrayList;
import java.util.List;
/** /**
* The Class Lambda1. * The Class Lambda1.
@@ -40,6 +40,14 @@ public abstract class Lambda1<R, A1> implements Lambda<R> {
*/ */
public abstract R apply(A1 arg1); public abstract R apply(A1 arg1);
public List<R> applyToIterable(Iterable<A1> arg1) {
List<R> result = new ArrayList<R>();
for(A1 a : arg1) {
result.add(this.apply(a));
}
return result;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *