Questions tagged [anonymous]

DO NOT USE! Please use a more specific tag such as [anonymous-function] or [anonymous-class].

The term anonymous has come to represent different aspects of development with the rise of the functional programming style and the use of anonymous on-demand applications.

In an effort to disambiguate this tag, it has been split into the following subcategories:

Category Description
Anonymous Classes An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator.
Anonymous Functions Anonymous functions use a block of code as a value, defining it as an inline function without a name.
Anonymous Methods An anonymous method is a procedure or function that does not have a name associated with it.
Anonymous Types Anonymous types are data types which dynamically add a set of properties into a single object without having to first explicitly define a type
Anonymous Users Anonymous users are individuals or systems that make use of a product or service, without formally registering account details and are instead associated with some token or identifier.

Former Tag Definition

For new questions, see [anonymous-class] and [anonymous-function].

Typically, a programming language construct like a function or class has a name associated with it -- a symbol that can be used to refer to the construct in some context. An anonymous function or class is one that, in contrast to normal practice, has no name. For example, in Java, you can create an anonymous class using a special syntax that defines a class and constructs an instance of it at the same time:

Runnable r = new Runnable() {
    public void run() {
        System.out.println("Running");
    }
};

The variable r holds a reference to an instance of a class which has no name in Java, but which implements the Runnable interface and can be used anywhere a Runnable instance is needed.

702 questions
-2
votes
1 answer

can I use "new SomeClass(){}" to be a parameter passed into a javascript function

I want to invoke a function like openInfoWindow(SomeClass sc), sc as a parameter. However,codes like this openInfoWindow(new SomeClass(){width=1;}) didn't work out. Is it invalid for a anonymous class to be passed into a function as a parameter in…
-2
votes
1 answer

Anonymous inner class v/s singleton class

What I understand from anonymous inner class is that it is used for defining and creating a object "on-the-fly-use-and-throw" and using the overridden methods. If this is being used multiple times across the program can this be a candidate for…
amith
  • 1
-2
votes
2 answers

Anonymous functions using Anonymous functions

im getting this error Parse error: parse error when using this function, $rows_tick = array_filter( $rows, function ($element) use ($date_tick) { return ($element['ModTime'] <=…
Khairu Aqsara
  • 1,321
  • 3
  • 14
  • 27
-2
votes
2 answers

How to assign values to an anonymous array other than initializing it?

Method accepts only anonymous arrays, like: setSomeValue(new String[] {'v1', 'v2', 'v3')); I want to copy the values of another array into this anonymous array before sending it to the setSomeValue method. The setsomeValue method: public void…
Leena Samuel
  • 67
  • 2
  • 12
-2
votes
2 answers

Anonymous Email from Android

Its been some weeks im looking for it, but just cant find. Does anyone know how can you send anonymous email from a Android? Im using Intent like in: Intent email = new Intent(Intent.ACTION_SEND); . . . email.putExtra(Intent.EXTRA_EMAIL , new…
-3
votes
2 answers

Which is best? PHP lambda vs class object method

wondering what is the performance different between the following approaches. // in dependencies.php $greeting=function(){echo "lambda";}; // in MyClass.php class MyClass{ function greeting(){echo "class";} } // in index.php include…
Zang
  • 3
  • 1
-4
votes
1 answer

Find underlying anonymous field type for struct in Go

I have these two structs: type CustomTime struct { time.Time } type Events struct { Timestamp CustomTime } When I reflect the field for Events.Timestamp, I get CustomTime; how can I get the actual underlying type which is time.Time?
user1529891
-4
votes
2 answers

Java Anonymous Object and Garbage collection part -2

private Student student = new Student(); public Student getStudent(){ return student; } public void function(){ getStudent().setName("john"); } public void function(){ Student student_local = getStudent(); …
Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
-4
votes
1 answer

Java - Looking for example comparing nested class with anonymous inner class

Can someone provide me with a good simple example of a regular nested class and then the same class re-written as an anonymous inner class?
-5
votes
1 answer

Initiate a private phone call for both side in Android app

I am building an Android app and want to initiate an anonymous phone call for both caller and receiver. For example: User A press 'call User B' button, and then initiate an anonymous phone call to User B. The tricky point is that both User A and B…
-6
votes
1 answer

Why do I get a $ sign in decompiled java classes full with errors?

I decompiled my lost apk and got all the resources and all java classes, but the problem is that I got all the .java files with errors and with dollar signs? I know these are anonymous java classes, but how to fix these errors? I can't find a way to…
-8
votes
1 answer

How translate to Swift an anonymous class of Java?

I'm new with Swift 2, I never had developed in Apple. Objective C has seemed ugly and you have to write a lot of code, so Swift liked because the syntax is similar to Java and C and here my question: In Java you can define a class of this way: new…
1 2 3
46
47