wildcard

difference between List and List<?> [duplicate]

主宰稳场 提交于 2019-12-22 18:27:44
问题 This question already has answers here : What's the difference between unbounded wildcard type List<?> and raw type List? (4 answers) Closed 10 months ago . I've read alot about this, and I know that: List<Object> listOfObject = new ArrayList<TYPE>(); // (0) //can only work for TYPE == Object. //if TYPE extends Object (and thus objects of type TYPE are Objects), //this is not the same with Lists: List<Type> is not a List<Object> Now I've read that the following is ok: List undefinedList = new

Unbounded wildcard passed to method

一笑奈何 提交于 2019-12-22 10:52:57
问题 public class ColTest { static<T> T wildSub(ArrayList<? extends T> holder, T arg){ T t=holder.get(0); return t; } public static void main(String[] args) { ArrayList<?> list=new ArrayList<Long>(Arrays.asList(2L,3L,7L)); Long lng=1L; ColTest.wildSub(list, lng); } } Really interested why this snippet is legal, because the signature of wildSub takes only ArrayList of T or derived from T , and arg of type T . But <?> means - some specific type, not known, and how it can satisfy the compiler? After

How to use internal links with wildcard items in Sitecore?

我只是一个虾纸丫 提交于 2019-12-22 06:33:31
问题 I have a multiple site Sitecore solution. All the sites share a product range which is stored inside a 'Shared data' node that sits at the same level as the root nodes of the sites. The individual product pages on a site use a wildcard item to lookup the product based on the last part of the URL. This means that we can't use internal links in the rich text editor to point to the product page on any of the sites because the product item does not have a specific site URL. Does anyone know of a

Google Spreadsheet, filter doesn't allow wildcards? How to countif multiple columns with wildcards?

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:33:38
问题 When I do: B C 223 herp 223 herp 3 herp 223 derp 223 herp,derp =countif(C:C, "*herp*") I correctly get 4. When I do =count(filter(B:B, B:B=223, C:C="*herp*")) I incorrectly get 0. When I remove the "*" wildcard characters, I get 2, which is better, but doesn't get herp,derp. Does filter not support wildcard characters? If so, how can I count a row only if two of it's columns meet two different criteria which have wildcards? 回答1: FILTER doesn't support wildcards, no. You need to do something

In Scala, what is the difference between using the `_` and using a named identifier?

匆匆过客 提交于 2019-12-22 03:43:43
问题 Why do i get an error when I try using _ instead of using a named identifier? scala> res0 res25: List[Int] = List(1, 2, 3, 4, 5) scala> res0.map(_=>"item "+_.toString) <console>:6: error: missing parameter type for expanded function ((x$2) => "item ".$plus(x$2.toString)) res0.map(_=>"item "+_.toString) ^ scala> res0.map(i=>"item "+i.toString) res29: List[java.lang.String] = List(item 1, item 2, item 3, item 4, item 5) 回答1: Underscores used in place of variable names like that are special; the

C# grammar and switch wildcard

帅比萌擦擦* 提交于 2019-12-22 01:32:11
问题 I would like to add, that whenever it recognizes 'search X' it is going to search for 'X', but i don't know how i have to add that to the grammar, or how to do such a thing with my switch statement. private void Form1_Load(object sender, EventArgs e) { Choices commands = new Choices(); commands.Add(new string[] { "hello", "start chrome", "search" }); GrammarBuilder gBuilder = new GrammarBuilder(); gBuilder.Append(commands); gBuilder.Culture = new System.Globalization.CultureInfo("en-GB");

GNU Make: Multiple PHONY Targets with Wildcard-like Functionality? (Passing different pre-processor directives to compiler)

懵懂的女人 提交于 2019-12-21 21:25:12
问题 The title here may be a little confusing because I had a hard time trying to word this in a single sentence. I understand that wildcards cannot be used with phony targets. This question is asking if there is any kind of workaround to accomplish passing different pre-processor directives to the compiler through make's PHONY targets. For example, I have software that will compile differently if MODEL_A, MODEL_B, or MODEL_C is defined. Therefore, if I pass -DMODEL_A to the compiler, it will

Confusion with shell-globbing wildcards and Regex

徘徊边缘 提交于 2019-12-21 20:55:07
问题 Initiated by the reply. How can I use only Regex instead of wildcards? Where do you really need wildcards and globbing if you can use Regex? Have Regexes evolved from wildcards or vice versa? 回答1: I think your confusion is based on the differences between shell-globbing wildcards (the * character) and the regular expression symbol (the * character). Regexes are not shell-globbing, they are a lot more powerful and useful, but for everyday shell use, wildcards and shell-globbing are "good

sed wildcard substitution

独自空忆成欢 提交于 2019-12-21 16:49:21
问题 I want to do a substitution based on a wildcard. For example, change all "tenure" to "disposition" only if the word "tenure" comes after an '=' sign. Basically a regex that would match this =.*tenure The sed command that I have so for this is: sed 's/=.*tenure/=.*disposition/g' file.txt However, if I pass this to a file containing: blah blah blah = change "tenure" to "disposition" I get blah blah blah =.*disposition" to "disposition" instead of: blah blah blah = change "disposition" to

sed wildcard substitution

烂漫一生 提交于 2019-12-21 16:49:15
问题 I want to do a substitution based on a wildcard. For example, change all "tenure" to "disposition" only if the word "tenure" comes after an '=' sign. Basically a regex that would match this =.*tenure The sed command that I have so for this is: sed 's/=.*tenure/=.*disposition/g' file.txt However, if I pass this to a file containing: blah blah blah = change "tenure" to "disposition" I get blah blah blah =.*disposition" to "disposition" instead of: blah blah blah = change "disposition" to