GVKun编程网logo

我可以在 linux 终端上使用手册页找到 java 方法吗?(linux查询手册)

3

如果您对我可以在linux终端上使用手册页找到java方法吗?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于我可以在linux终端上使用手册页找到java方法吗?的详细内容

如果您对我可以在 linux 终端上使用手册页找到 java 方法吗?感兴趣,那么本文将是一篇不错的选择,我们将为您详在本文中,您将会了解到关于我可以在 linux 终端上使用手册页找到 java 方法吗?的详细内容,我们还将为您解答linux查询手册的相关问题,并且为您提供关于c# – 隐式运算符优先于ToString()方法吗?、C# 中有 unequals() 方法吗?、dropWiizard metrics.core 4.2.0-beta* 中缺少 metricRegistery.settableGauge( String ) 方法吗?、Eclipse Collections - Sets 有 containsAny() 方法吗?的有价值信息。

本文目录一览:

我可以在 linux 终端上使用手册页找到 java 方法吗?(linux查询手册)

我可以在 linux 终端上使用手册页找到 java 方法吗?(linux查询手册)

如何解决我可以在 linux 终端上使用手册页找到 java 方法吗?

问题: 我意识到我可以在 linux 上使用 man 命令来查看 linux 命令的类。我可以在终端上查找 java 方法而不是在网络浏览器上搜索它们吗?

在终端上,当我输入 man java 时,我看到了在终端上运行的 java 的描述。

你经常在网上查找java方法吗?

c# – 隐式运算符优先于ToString()方法吗?

c# – 隐式运算符优先于ToString()方法吗?

参见英文答案 > Order of implicit conversions in c#                                    1个
请考虑以下代码:

public class Test
{
    public static implicit operator int(Test t) { return 42; }
    public override string ToString() { return "Test here!"; }
}

var test = new test();
Console.WriteLine(test); // 42
Console.WriteLine((Test)test); // 42
Console.WriteLine((int)test); // 42
Console.WriteLine(test.ToString()); // "Test here!"

为什么在前三个案例中,即使我们明确地转向测试,我们也会回答42?
隐式运算符优先于ToString()吗?

解决方法

是.隐式运算符优先于显式运算符.语言规范声明隐式运算符不应该丢失信息,而显式运算符允许这样做.例如,参见 MSDN explicit.如果将隐式关键字更改为显式,您将在此处看到Test! 3次,42次一次.

public class Test
{
    public static explicit operator int(Test t) { return 42; }
    public override string ToString() { return "Test here!"; }
}

var test = new test();
Console.WriteLine(test); // "Test here!"
Console.WriteLine((Test)test); // "Test here!"
Console.WriteLine((int)test); // 42
Console.WriteLine(test.ToString()); // "Test here!"

C# 中有 unequals() 方法吗?

C# 中有 unequals() 方法吗?

如何解决C# 中有 unequals() 方法吗?

我对 C# 很陌生,正在编写一些小示例。

我有一个列表:

  1. var myList = {2,2,5,4,7,8,10,11,12,9};

我知道以下将检查列表是否包含“0”:

  1. myList.Equals(0);

但是如何检查列表中不包含“0”呢? 有没有类似的东西:

  1. myList.UnEquals(0);

  1. !myList.Equals(0);

解决方法

没有 UnEqualsNotEquals 方法,因为它不是必需的。但首先,对象上的 Equals 方法用于检查相等性。如果要检查列表是否包含某个值,请使用 List.Contains 方法。

现在,为什么不需要它?因为我们有非运算符 !。由于布尔值只能是 truefalse,我们使用 not 运算符来否定它们。所以你要找的代码是

  1. bool doesNotContainZero = !myList.Contains(0);

所以做这样的事情:

  1. if (!myList.Contains(0))
  2. {
  3. // Do stuff...
  4. }

可以理解为

如果我的列表不包含 0,那就做点什么

,
  1. Boolean check = myList.Contains(0);

会输出一个Boolean(真/假),假表示不包含(0)

然后您可以在 If 语句中使用它来执行某些操作

  1. If(mylist.Contains(0))
  2. {
  3. //Some Actions
  4. }
,

@Mostafa Tarek Yassien 已经回答得很好,您应该使用 myList.Contains(0)。我将补充一点,因为您是 C# 新手,您可以使用任何将布尔结果直接返回到逻辑评估语句中的函数,例如 (if,while,switch)。

例如: 如果 ( mylist.Contains(0) ) { .... 在这里做你的事 }

这非常有用,因为您有时必须使用结果在您的代码中做出决定。

dropWiizard metrics.core 4.2.0-beta* 中缺少 metricRegistery.settableGauge( String ) 方法吗?

dropWiizard metrics.core 4.2.0-beta* 中缺少 metricRegistery.settableGauge( String ) 方法吗?

如何解决dropWiizard metrics.core 4.2.0-beta* 中缺少 metricRegistery.settableGauge( String ) 方法吗?

对于计数器、仪表和仪表,有一些方法可以返回现有指标或注册新指标并返回该指标。所以 metricRegistery.counter( "foo" ); 将返回名为“foo”的计数器,即使它必须先创建和注册它。最方便。

然而,虽然 4.2.0-beta* 中的新 settableGauge 指标类型只是我想要的,但我没有看到类似的 return-creating-if-need-be 方法返回 settableGauge(String,Long) SettableGauge。这是真的丢失了还是我(或我的 IDE)只是没有找对地方?

Eclipse Collections - Sets 有 containsAny() 方法吗?

Eclipse Collections - Sets 有 containsAny() 方法吗?

如何解决Eclipse Collections - Sets 有 containsAny() 方法吗?

我似乎在 Eclipse 集合中找不到 containsAny() 类型的 SetIterable 方法。有吗?

  1. MutableSet<String> set1 = Sets.mutable.of("a","b","c");
  2. ImmutableSet<String> set2 = Sets.immutable.of("c","d","e");
  3. set1.containsAny(set2); // I can''t find this method.

写一个很容易:

  1. /**
  2. * True if [set1] contains any element in [set2].
  3. */
  4. public static <T> boolean intersects(SetIterable<T> set1,SetIterable<? extends T> set2) {
  5. return set1.intersect(set2).notEmpty();
  6. }

但我只是想知道是否已经存在。

解决方法

我没有看到 containsAny 方法,但您可以这样做:

  1. set2.anySatisfy(set1::contains);

我们今天的关于我可以在 linux 终端上使用手册页找到 java 方法吗?linux查询手册的分享已经告一段落,感谢您的关注,如果您想了解更多关于c# – 隐式运算符优先于ToString()方法吗?、C# 中有 unequals() 方法吗?、dropWiizard metrics.core 4.2.0-beta* 中缺少 metricRegistery.settableGauge( String ) 方法吗?、Eclipse Collections - Sets 有 containsAny() 方法吗?的相关信息,请在本站查询。

本文标签: