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 754965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:04:29+00:00 2026-05-14T15:04:29+00:00

I try to simplify conditionals in: for ( int t=0, size=fo.getPrintViewsPerFile().size(); t<size && t<countPerFile;

  • 0

I try to simplify conditionals in:

for ( int t=0, size=fo.getPrintViewsPerFile().size();
          t<size && t<countPerFile;
          t++)
{
    // ...
}

, more precisely:

t<s && t<c

You need to compare two times, then calc the boolean value from them. Is there any simpler way to do it? If no, how can you prove it? I can simplify it to some extent, proof tree.

[Added]

I tried to solve the problem directly through logic. It would interesting to see the implication in choosing the minima. Link:

http://www.umsu.de/logik/trees/?f=(\exists%20s%20\exists%20c%20\forall%20t%20%20(Pts%20\land%20Ptc))\leftrightarrow\neg(\foralls\forallc\existst(\neg(Pts)\lor\neg(Ptc)))

  • 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-05-14T15:04:30+00:00Added an answer on May 14, 2026 at 3:04 pm

    You can do t < Math.min(s, c), but that wouldn’t actually reduce the number of comparison.

    I do think that appropriate use of Math.min and Math.max makes for a much more readable code, though. Unfortunately they only have overloads for 2 args (for int, long, float and double arguments). It would’ve been really nice if they also have 3 args and varargs overloads.

    You can always write utilities method for these kinds of things (interval checking is a common idiom (minV <= v) && (v <= maxV) etc), but linguistically, no Java doesn’t have any fancy operators that would do these things. They only have basic numerical comparison operators (JLS 15.20.1) and basic boolean operators (JLS 15.22.2, 15.23, 15.24).


    Sidenote

    Higher-level languages like Icon does allow these kinds of constructs:

    Java                      Icon
    (x < v1) || (x < v2)      x < (v1 | v2)
    (a < b) && (b < c)        a < b < c
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using java on a big amount of data. [i try to simplify the
try { JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++) { JSONObject json_data = jArray.getJSONObject(i);
I will try to explain what exactly I need to do. I have 3
template<typename T> class ClassVariantVisitor : public boost::static_visitor<T> { public: T operator()(int& i) const {
Bear with me as I try to simplify my issue as much as possible.
I'll try to simplify the problem as much as I can. I have an
I'm gonna try and simplify this as much as possible. Lets say i have
Answered Dbaseman was correct but to simplify it all, I don’t need a modal
#!/usr/bin/python # # Description: I try to simplify the implementation of the thing below.
I'll try to simplify and make clear my other question here. I am basically

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.