Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:44:53+00:00 2026-06-06T13:44:53+00:00

I would like to emulate the following interface: interface MultiSideEffectFunction<T> { void action(T first,

  • 0

I would like to emulate the following interface:

interface MultiSideEffectFunction<T> {
    void action(T first, T second);
}

(it would save me from having to introduce a new interface)

is there a preferred Guava approach to doing this?

Note: I thought about doing it with

Function<Pair<T>, Void>

but there are two problems which makes the creation of a new interface preferable:

  1. One must define a class called Pair<T>, which looks a lot like a Map.Entry<T, T> with more appropriate getter names (as a second question: is there a Guava type like this?).
  2. The Void return type is always a pain – it would be better to have a genuine void signature.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:44:55+00:00Added an answer on June 6, 2026 at 1:44 pm

    Guava contributor here.

    The preferred Guava approach is to write your own interface.

    In particular, do not use Function; Function should only be used when the function doesn’t have side effects.

    Guava deliberately lacks a Pair type; we advise that any time you need a pair, you create your own class that attaches useful names to the two values, rather than the utterly uninformative “first” and “second”. (The prototypical example is for GPS coordinates; a class entitled LatLong is much more informative than a Pair<Double, Double>.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to emulate the pass-by-value behaviour in python. In other words, I
I would like a LinearLayout translucent (I don't mean transparent). I want to emulate
Would like to sort the following XML by joining the fsxml/formula/ingrrow where itemcode =
I would like to emulate the 'Drop Pin' feature in the Maps application. I
I would like to be able to programmatically emulate the keyboard navigation for dialog
I would like to test my application with new Samsung Galaxy Tab tablet. What
Using the emulator, with external storage attached, I would like to emulate what happens
I would like to try using .htc files or PIE to emulate some CSS3
I would like to get an FPGA development board with the goal to emulate
I have seen a feature on a site I would like to emulate. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.