Functional programming in Java

  • Authors:
  • David R. Naugler

  • Affiliations:
  • Southeast Missouri State University Cape Girardeau MO

  • Venue:
  • Journal of Computing Sciences in Colleges
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

In functional languages such as Scheme or ML functions can be passed as parameters, can be constructed in other functions and returned as values. This allows a style of programming that is quite distinct from that used with languages such as Pascal, C or C++. Superficially, Java has no functions; however, using interfaces and inner classes it is fairly easy to mimic some of the important features of functional programming. Using an interface for real functions, it is shown how to write functions that take functions as parameters and construct and return new function. It is not advocated that functional programming be taught in Java - languages such as ML are much superior for that task. Rather, students can use modes of thinking learned in a study of a functional languages directly in programmes written in Java.