Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Random Java Array/Boolean Question

Featured Replies

I'm just curious about this. Let's say I have an array of ten objects and a boolean called "isRunning." Is there a way to test the whole array for this boolean? In other words, instead if saying "if(object[0].isRunning==true && object[1].isRunning==true && object[2].isRunning==true && ... etc)" and instead of creating a for loop, is there a way to be like... "if(object[0-9].isRunning==true)"? Address all objects in an array or something similar?

kosig.jpg
I'm just curious about this. Let's say I have an array of ten objects and a boolean called "isRunning." Is there a way to test the whole array for this boolean? In other words, instead if saying "if(object[0].isRunning==true && object[1].isRunning==true && object[2].isRunning==true && ... etc)" and instead of creating a for loop, is there a way to be like... "if(object[0-9].isRunning==true)"? Address all objects in an array or something similar?

 

 

 

Have to use a for loop. You can only access one variable at a time during a value comparison.

 

 

 

 

 

 

 

 

 

 

 

not like a for loop would be much more effort anways...

  • Author
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:every

 

 

 

 

 

 

 

Mozilla/Gecko specific JS extension. I'm betting java has a similar thing though, but alas I don't know java :(

 

 

 

Ooh, that's cool. Well, no worries, I don't know much about JavaScript. =P

 

 

 

 

 

 

 

Have to use a for loop. You can only access one variable at a time during a value comparison.

 

 

 

 

 

 

 

not like a for loop would be much more effort anways...

 

 

 

Oy, okay, thanks. Yeah, it's not much effort, it's just that something I was writing up awhile ago wasn't working with a for loop. It was so long ago that I can't even remember what it was--I've just always had the question since then, haha. It was a situation where everything needed to be checked together, which is why the other option was writing out every object in an if statement.

kosig.jpg

Hannibal: Can't use JavaScript API much for Java. Gotta use the Java API ;)

 

 

 

 

 

 

 

 

 

 

 

And just for the record, there is no function like every() within the Java API that I can find.

 

 

 

Least not for generic use anyways... You could write your own, but it'd have to contain a for loop anways so meah :P

  • Author
You could write your own, but it'd have to contain a for loop anways so meah :P

 

 

 

Okay, point taken, I can't avoid the for loop. :P

kosig.jpg
Hannibal: Can't use JavaScript API much for Java. Gotta use the Java API ;)

 

 

 

 

 

 

 

 

 

 

 

And just for the record, there is no function like every() within the Java API that I can find.

 

 

 

 

 

 

 

>_>

 

 

 

 

 

 

 

I'm well aware JavaScript won't work in a Java environment, just saying I expected the javascript function to have a base in either Java or C(++). As said, I don't 'know' Java. So I was just suggesting to look in a direction like that :P

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.