Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-2 votes
2 answers
342 views

Meaning of two double brackets ([][]) in Java

What is the role of a pair of double brackets ([][]) in Java? reference code(Leetcode 1351. Count Negative Numbers in a Sorted Matrix): class Solution { public int countNegatives(int[][] grid) { ...
Abhishek Thakur's user avatar
0 votes
1 answer
317 views

Regex to parse multi-brace (and brackets) string

I am currently working on an import feature in a Java project and am receiving objects as a string. A structure similar to JSON is being used here. Objects are enclosed in curly braces and lists go in ...
Chris van Darg's user avatar
0 votes
0 answers
284 views

Override toString() method to remove Square brackets? [] [duplicate]

EDIT I changed toString method like this and now it works. @Override public String toString(){ Mylist.forEach((a) -> { System.out.print(a+" "); }); return ""; } There is a ...
andrea's user avatar
  • 406
-1 votes
1 answer
3k views

Java: square brackets when declaring HashMap?

I'm trying to adapt code from here and I can't figure out why they've declared and instantiated their HashMaps using square brackets. Here's some simplified sample code: class CommunityStructure { ...
istewart's user avatar
  • 439
0 votes
2 answers
5k views

How to use square brackets for math in Java?

While converting a mathematical formula to Java, I encountered square brackets (I found them in the formula). I don't know what they mean in mathematics, because I'm no math expert, just a 14-year old ...
Daniel Kvist's user avatar
  • 3,042
1 vote
3 answers
1k views

Java: regex to find outer square brackets pairs

I would like to find the content of all the outer square brackets pairs in a string. If an outer pair has an inner pair then it should not be matched separately. For example string: [abc][123][cde[...
Sari Amitay's user avatar
0 votes
0 answers
555 views

StringTokenizing an expression with brackets in Java

I'm doing homework for my data structures class and ran into a snag at a certain point. Basically, I have an expression like (varx + vary*varz[(vara+varb[(a+b)*33])])/55 and I have to store the ...
farris awadallah's user avatar
0 votes
2 answers
182 views

Java // No match with RegExp and square brackets

I have a string like Berlin -> Munich [label="590"] and now I'm searching a regular expression in Java that checks if a given line (like above) is valid or not. Currently, my RegExp looks like \\...
Andy's user avatar
  • 81
0 votes
1 answer
6k views

square bracket characters in email address

When we receive a MimeMessage which contains recipient InternetAddresses containing square brackets, we get 'javax.mail.internet.AddressException: Local address contains illegal character in string' ...
Going Bananas's user avatar
1 vote
3 answers
1k views

Find text in square brackets but not in parentheses

If I have a string like this (from a Wiki-markup) that I need to parse in Java: this link (is [[ inParen ]] and) (this) one is [[ notInParen ]] I'd like to use regex to extract the texts inside the [...
JeffThompson's user avatar
  • 1,600