diff --git a/app/Locabean/src/com/locaudio/functional/Function.java b/app/Locabean/src/com/locaudio/functional/Function.java index 0be97ab..9635c05 100644 --- a/app/Locabean/src/com/locaudio/functional/Function.java +++ b/app/Locabean/src/com/locaudio/functional/Function.java @@ -1,9 +1,36 @@ package com.locaudio.functional; +import java.util.ArrayList; +import java.util.List; + public abstract class Function { + public abstract R body(T input); - + public R call(T input) { return body(input); } + + public List map( + Function f, IN_TYPE[] inArray) { + + List retList = new ArrayList(); + for (IN_TYPE inVal : inArray) { + retList.add(f.call(inVal)); + } + + return retList; + } + + public List map( + Function f, List inArray) { + + List retList = new ArrayList(); + for (IN_TYPE inVal : inArray) { + retList.add(f.call(inVal)); + } + + return retList; + } + }