equivalent Questions
6
Solved
In Python, you can have key,value pairs in a dictionary where you can loop through them, as shown below:
for k,v in d.iteritems():
print k,v
Is there a way to do this with Java HashMaps?
Jumbala asked 1/7, 2010 at 12:6
5
Solved
I study data structures and I want to ask what are the equivalents of STL containers.
for example
vector = dynamic array
queue = queue
stack = stack
priority_queue = heap
list = linked list
set ...
Unclasp asked 16/6, 2012 at 15:14
2
Solved
Perl RegEx and PCRE (Perl-Compatible RegEx) amongst others have the shorthand \K to discard all matches to the left of it except for capturing groups, but Java doesn't support it, so what's Java's ...
Mayotte asked 23/7, 2017 at 13:33
25
Solved
Is there an XSLT equivalent for JSON? Something to allow me to do transformations on JSON like XSLT does to XML.
Jadda asked 24/10, 2009 at 13:40
8
Solved
What is the C# equivalent of Python slice operations?
my_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
result1 = my_list[2:4]
result2 = my_list[1:]
result3 = my_list[:3]
result4 = my_list[:3] + my_li...
Hammering asked 19/12, 2013 at 10:7
9
Solved
Is there a way to do the following preprocessor directives in Python?
#if DEBUG
< do some code >
#else
< do some other code >
#endif
Swafford asked 27/1, 2009 at 1:10
17
I need to fill a byte[] with a single non-zero value. How can I do this in C# without looping through each byte in the array?
Update: The comments seem to have split this into two questions -
Is...
Corrade asked 13/12, 2009 at 19:59
9
Solved
Is there a Pythonic equivalent to Ruby's #each_cons?
In Ruby you can do this:
array = [1,2,3,4]
array.each_cons(2).to_a
=> [[1,2],[2,3],[3,4]]
Menses asked 4/5, 2011 at 4:6
4
I have executed minikube service mynginx1 and the result is:
|-----------|----------|-------------|-----------------------------|
| NAMESPACE | NAME | TARGET PORT | URL |
|-----------|---------...
Whitten asked 6/5, 2020 at 5:32
5
I need the equivalent code of setTimeOut(call function(),milliseconds); for android.
setTimeOut(call function(),milliseconds);
Harryharsh asked 7/1, 2012 at 18:24
3
Solved
In Java, you can make a variable thread safe by just adding the synchronized keyword. Is there anything that can achieve the same results in Python?
Madwort asked 27/10, 2018 at 21:55
3
Solved
Greetings Overflowers,
I know in C we can define a struct inline with the variable declaration so that the struct type is specific to this variable. This is instead of defining the type alone then...
Cracy asked 7/4, 2011 at 9:45
7
Solved
Was looking for "equivalent for some method in javascript" and "return just one value if is in array", but saw only the answers to the way in which to determine the type of variables or too many un...
Pattani asked 29/4, 2013 at 2:53
6
Solved
Python supports the following operation:
>>> s = Template('$who likes $what')
>>> s.substitute(who='tim', what='kung pao')
'tim likes kung pao'
(Example taken from Python...
Tims asked 23/8, 2014 at 10:6
4
Solved
The python collections.Counter object keeps track of the counts of objects.
>> from collections import Counter
>> myC = Counter()
>> myC.update("cat")
>> myC.update("cat")
...
Brookes asked 30/10, 2018 at 0:1
5
Solved
Is there a pure JS equivalent of jQuery .is() on modern browsers?
I know there is the querySelector method, but I want to check the node itself, rather than finding child nodes.
Milch asked 14/5, 2014 at 2:16
4
Most places I've consulted say to use SortedList, but the problem is that the program I'm porting actually uses duplicate keys (differentiated by order), which is permissible with TreeMap, but not ...
Disbursement asked 25/1, 2009 at 17:28
4
Solved
To reword the question in case someone types it into the search bar differently:
Is pass-by-value the same as making a deep copy, and is pass-by-reference the same as making a shallow copy?
If not...
Anarthrous asked 12/7, 2017 at 19:8
7
Solved
I have a class with some static members, and I want to run some code to initialize them (suppose this code cannot be converted into a simple expression). In Java, I would just do
class MyClass {
s...
Wite asked 7/10, 2013 at 14:38
6
Solved
Q: Do we have anything functionally equivalent in Python to the Ruby version manager 'rvm'?
(RVM lets you easily switch completely between different versions of the ruby interpreter and differe...
Normalie asked 11/5, 2010 at 16:25
1
Solved
I need to get the hexa value of a file i have.
On linux, this was Simply done with :
hexdump -ve '1/1 "%.2x"' Filename
However, on Windows, i couldn't found a good equivalent for hexdump. I'm ...
Callender asked 18/10, 2019 at 6:19
3
Solved
How can I properly prove that
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
sequenceA [] = pure []
sequenceA (x:xs) = pure (:) <*> x <*> sequenceA xs
is ess...
Elias asked 29/7, 2019 at 4:35
2
Solved
array = some kind of list with 3 columns and unlimited amount of rows with data inside of it.
Volume = array[0][2]
counter = 0
for i in array:
if Volume == array[i][2]: #<------ why is this ...
Philomena asked 19/5, 2016 at 16:58
7
Solved
BigDecimal is a class in the java.math package that has a lot of benefits for handling big numbers of a certain scale. Is there an equivalent class or data type in c# with this feature.
Meilhac asked 19/5, 2010 at 6:44
5
Solved
I'm proficient in Python but a noob at Scala. I'm about to write some dirty experiment code in Scala, and came across the thought that it would be really handy if Scala had a function like help() i...
Nickname asked 8/7, 2013 at 22:3
1 Next >
© 2022 - 2025 — McMap. All rights reserved.